Zi 字媒體
2017-07-25T20:27:27+00:00
Linux C function() 參考手冊:settimeofday(設置目前時間)
資料來源:http://people.cs.nctu.edu.tw/~yslin/library/linuxc/main.htm線上執行:http://www.tutorialspoint.com/compile_c_online.phpcode2html:http://tohtml.com/
相關函數time,ctime,ftime,gettimeofday表頭文件#include#include定義函數int settimeofday ( const struct timeval *tv,const struct timezone *tz);函數說明settimeofday()會把目前時間設成由tv所指的結構信息,當地時區信息則設成tz所指的結構。詳細的說明請參考gettimeofday()。注意,只有root權限才能使用此函數修改時間。返回值成功則返回0,失敗返回-1,錯誤代碼存於errno。錯誤代碼EPERM 並非由root權限調用settimeofday(),權限不夠。EINVAL 時區或某個數據是不正確的,無法正確設置時間。
寫了
5860316篇文章,獲得
23313次喜歡