急!!!请问如何编程设置soloris系统的系统时间?

如何编程实现:
修改当前的系统时间

---------------------------------------------------------------

ultra60No2% man -s 2 stime

System Calls stime(2)

NAME
stime - set system time and date

SYNOPSIS
#include

 1<unistd.h>   
 2  
 3int stime(const time_t *tp);   
 4  
 5DESCRIPTION   
 6stime() sets the system's idea of the time and date. tp   
 7points to the value of time as measured in seconds from   
 800:00:00 UTC January 1, 1970.   
 9  
10RETURN VALUES   
11Upon successful completion, a value of 0 is returned. Oth-   
12erwise, a value of -1 is returned and errno is set to indi-   
13cate the error.   
14  
15ERRORS   
16stime() will fail if:   
17  
18EPERM The effective user of the calling process is   
19not super-user.   
20  
21SEE ALSO   
22time(2)   
23  
24SunOS 5.6 Last change: 5 Jul 1990 1   
25  
26\---------------------------------------------------------------   
27  
28调用system()函数,里面的参数就是date 日期   
29  
30\---------------------------------------------------------------   
31  
32只要你知道date可以做这件事,你就可以用truss来看是用什么系统调用实现这个功能的。   
33\---------------------------------------------------------------   
34  
35settimeofday()</unistd.h>
Published At
Categories with 服务器类
Tagged with
comments powered by Disqus