How to call time from time.h with Cython?

后端 未结 2 1302
囚心锁ツ
囚心锁ツ 2021-01-16 06:26

I am trying to load time.h directly with Cython instead of Python\'s import time but it doesn\'t work.

All I get is an error

Call with w         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 06:38

    Pass in NULL to time. Also you can use the builtin libc.time:

    from libc.time cimport time,time_t
    
    cdef time_t t = time(NULL)
    print t
    

    which gives

    1471622065
    

提交回复
热议问题