Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148045232
D34751.id104528.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34751.id104528.diff
View Options
Index: lib/libc/gen/time.3
===================================================================
--- lib/libc/gen/time.3
+++ lib/libc/gen/time.3
@@ -32,7 +32,7 @@
.\" @(#)time.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd March 4, 2022
+.Dd April 3, 2022
.Dt TIME 3
.Os
.Sh NAME
@@ -49,7 +49,7 @@
.Fn time
function
returns the value of time in seconds since 0 hours, 0 minutes,
-0 seconds, January 1, 1970, Coordinated Universal Time.
+0 seconds, January 1, 1970, Coordinated Universal Time (UTC).
If an error occurs,
.Fn time
returns the value
@@ -73,12 +73,62 @@
The
.Nm
function conforms to
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
.Sh HISTORY
A
.Fn time
-function appeared in
-.At v6 .
+system call first appeared in
+.At v1 .
+The
+.At v1
+and
+.At v2
+returned the time after the January 1, 1971.
+The version of
+.At v3
+counted time in sixtieths of a second with a 32-bit return value,
+ensuring an integer overflow crisis every 2.26 years.
+Due to challenges in reconstructing dates from tapes the count was
+changed to a new epoch and the returned time was the count from
+January 1, 1972.
+.Pp
+In
+.At v4
+the granularity of the return value was reduced to whole seconds,
+delaying the aforementioned crisis until 2038.
+.Pp
+.At v7
+introduced the
+.Fn ftime
+system call, which returned time at a millisecond level,
+though retained the
+.Fn gtime
+system call (exposed as
+.Fn time
+in userland).
+.Fn time
+could have been implemented as a wrapper around
+.Fn ftime ,
+but that wasn't done.
+.Pp
+.Bx 4.1c
+implemented a higher-precision time function
+.Fn gettimeofday
+to replace
+.Fn ftime
+and reimplemented
+.Fn time
+in terms of that.
+.Pp
+Since
+.Fx 9
+the implementation of
+.Fn time
+uses
+.Fn clock_gettime "CLOCK_SECOND"
+instead of
+.Fn gettimeofday
+for performance reasons.
.Sh BUGS
Neither
.St -isoC-99
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 16, 9:37 AM (11 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29764700
Default Alt Text
D34751.id104528.diff (1 KB)
Attached To
Mode
D34751: time(3): Update the HISTORY section
Attached
Detach File
Event Timeline
Log In to Comment