📄 time.2
字号:
.\" Copyright (c) 1980 Regents of the University of California..\" All rights reserved. The Berkeley software License Agreement.\" specifies the terms and conditions for redistribution..\".\" @(#)gettimeofday.2 6.7 (Berkeley) 5/14/86.\".TH TIME 2 "May 14, 1986".UC 4.SH NAMEtime, stime \- get/set date and time.SH SYNOPSIS.nf.ft B#include <sys/types.h>#include <time.h>time_t time(time_t *\fItp\fP)int stime(time_t *\fItp\fP).fi.SH DESCRIPTIONThe system's notion of the current Greenwich timeis obtained with the.B timecall, and set with the.B stimecall.The time is expressedin seconds since midnight (0 hour), January 1, 1970.The time is both returned by.B timeand stored in the variable pointed to by.I tpunless.I tpis the null pointer..PP.B Stimeobtains the time to set from the variable pointed to by.IR tp ..PPOnly the super-user may set the time of day..SH RETURNA 0 return value from.B stimeindicates that the call succeeded..B Timereturns the current time on success.A \-1 return value indicates an error occurred, and in thiscase an error code is stored into the global variable \fBerrno\fP..SH "ERRORSThe following error codes may be set in \fBerrno\fP:.TP 15[EFAULT]The.I tpaddress referenced invalid memory..TP 15[EPERM]A user other than the super-user attempted to set the time..SH "SEE ALSO".BR date (1),.BR ctime (3).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -