#include time.h和 #include sys/time.h的區別

交叉編譯情況下,兩個文件的地址

/opt/gcc-4.1.2-glibc-2.4/arm-xscale-linux-gnu/arm-xscale-linux-gnu/include/time.h

 

/opt/gcc-4.1.2-glibc-2.4/arm-xscale-linux-gnu/arm-xscale-linux-gnu/include/sys/time.h

 

 

time.h 是ISO C99 標準日期時間頭文件。

sys/time.h 是Linux 系統的日期時間頭文件。

sys/time.h 通常會包含include time.h

 

 

編寫的代碼如果是平臺無關的,則需要在代碼裏include time.h. 

但這樣的話,使用time_t等數據結構的話可能需要手動

#define __need_time_t

#define __need_timespec

 

通常如果代碼可以是平臺相關的,則只需要include sys/time.h

 http://blog.csdn.net/stevenliyong/article/details/3863374

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章