当前位置: 技术问答>linux和unix
急!!!请问如何编程设置soloris系统的系统时间?
来源: 互联网 发布时间:2015-04-04
本文导语: 如何编程实现: 修改当前的系统时间 | ultra60No2% man -s 2 stime System Calls stime(2) NAME stime - set system time and date SYNOPSIS ...
如何编程实现:
修改当前的系统时间
修改当前的系统时间
|
ultra60No2% man -s 2 stime
System Calls stime(2)
NAME
stime - set system time and date
SYNOPSIS
#include
int stime(const time_t *tp);
DESCRIPTION
stime() sets the system's idea of the time and date. tp
points to the value of time as measured in seconds from
00:00:00 UTC January 1, 1970.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and errno is set to indi-
cate the error.
ERRORS
stime() will fail if:
EPERM The effective user of the calling process is
not super-user.
SEE ALSO
time(2)
SunOS 5.6 Last change: 5 Jul 1990 1
System Calls stime(2)
NAME
stime - set system time and date
SYNOPSIS
#include
int stime(const time_t *tp);
DESCRIPTION
stime() sets the system's idea of the time and date. tp
points to the value of time as measured in seconds from
00:00:00 UTC January 1, 1970.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and errno is set to indi-
cate the error.
ERRORS
stime() will fail if:
EPERM The effective user of the calling process is
not super-user.
SEE ALSO
time(2)
SunOS 5.6 Last change: 5 Jul 1990 1
|
调用system()函数,里面的参数就是date 日期
|
只要你知道date可以做这件事,你就可以用truss来看是用什么系统调用实现这个功能的。
|
settimeofday()