一.手工配置:
修改时间: # date -s 10:10:10
修改日期: # date -s 11/30/2007
写入cmos: #clock -w
二.程序更改:
gettimeofday(); /*获取当前时间*/
settimeofday(); /*更改当前时间*/
static int stime(time_t new_time, int usec)
{
struct timeval tv;
tv.tv_sec = new_time;
tv.tv_usec = usec;
settimeofday(&tv, NULL);
return 0;
}
修改时间: # date -s 10:10:10
修改日期: # date -s 11/30/2007
写入cmos: #clock -w
二.程序更改:
gettimeofday(); /*获取当前时间*/
settimeofday(); /*更改当前时间*/
static int stime(time_t new_time, int usec)
{
struct timeval tv;
tv.tv_sec = new_time;
tv.tv_usec = usec;
settimeofday(&tv, NULL);
return 0;
}