Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/gettimeofday.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95 | .\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd October 27, 2018 | .Dd March 4, 2020 | ||||
.Dt GETTIMEOFDAY 2 | .Dt GETTIMEOFDAY 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm gettimeofday , | .Nm gettimeofday , | ||||
.Nm settimeofday | .Nm settimeofday | ||||
.Nd get/set date and time | .Nd get/set date and time | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In sys/time.h | .In sys/time.h | ||||
.Ft int | .Ft int | ||||
.Fn gettimeofday "struct timeval *tp" "struct timezone *tzp" | .Fn gettimeofday "struct timeval *tp" "struct timezone *tzp" | ||||
.Ft int | .Ft int | ||||
.Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp" | .Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
.Em Note : | |||||
The | |||||
.Nm | |||||
function is obsolescent. | |||||
See the | |||||
.Sx STANDARDS | |||||
section for more details. | |||||
.Pp | |||||
The system's notion of the current Greenwich time and the current time | The system's notion of the current Greenwich time and the current time | ||||
zone is obtained with the | zone is obtained with the | ||||
.Fn gettimeofday | .Fn gettimeofday | ||||
system call, and set with the | system call, and set with the | ||||
.Fn settimeofday | .Fn settimeofday | ||||
system call. | system call. | ||||
The time is expressed in seconds and microseconds | The time is expressed in seconds and microseconds | ||||
since midnight (0 hour), January 1, 1970. | since midnight (0 hour), January 1, 1970. | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr date 1 , | .Xr date 1 , | ||||
.Xr adjtime 2 , | .Xr adjtime 2 , | ||||
.Xr clock_gettime 2 , | .Xr clock_gettime 2 , | ||||
.Xr ctime 3 , | .Xr ctime 3 , | ||||
.Xr timeradd 3 , | .Xr timeradd 3 , | ||||
.Xr clocks 7 , | .Xr clocks 7 , | ||||
.Xr timed 8 | .Xr timed 8 | ||||
.Sh STANDARDS | |||||
The | |||||
.Nm | |||||
function is considered obsolescent and its usage discouraged by | |||||
.\" XXX: This should be replaced in the future when an appropriate argument to | |||||
.\" the St macro is available: -p1003.1-2017 | |||||
.No IEEE Std 1003.1-2008, 2017 Edition (\\(LqPOSIX.1\\(Rq) . | |||||
0mp: Related differential revision: https://reviews.freebsd.org/D23944 | |||||
Application should use the | |||||
.Xr clock_gettime 2 | |||||
function instead as | |||||
.Nm | |||||
might be removed in the future. | |||||
.Sh HISTORY | .Sh HISTORY | ||||
The | The | ||||
.Fn gettimeofday | .Fn gettimeofday | ||||
system call appeared in | system call appeared in | ||||
.Bx 4.2 . | .Bx 4.2 . |
Related differential revision: https://reviews.freebsd.org/D23944