Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148347473
D39715.id120714.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D39715.id120714.diff
View Options
diff --git a/include/time.h b/include/time.h
--- a/include/time.h
+++ b/include/time.h
@@ -174,6 +174,8 @@
int timer_oshandle_np(timer_t timerid);
time_t time2posix(time_t t);
time_t posix2time(time_t t);
+struct tm *offtime(const time_t *, long);
+struct tm *offtime_r(const time_t *, long, struct tm *);
#endif /* __BSD_VISIBLE */
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
diff --git a/lib/libc/stdtime/ctime.3 b/lib/libc/stdtime/ctime.3
--- a/lib/libc/stdtime/ctime.3
+++ b/lib/libc/stdtime/ctime.3
@@ -44,6 +44,8 @@
.Nm localtime ,
.Nm localtime_r ,
.Nm mktime ,
+.Nm offtime ,
+.Nm offtime_r ,
.Nm timegm
.Nd transform binary date and time values
.Sh LIBRARY
@@ -71,14 +73,19 @@
.Fn localtime_r "const time_t *clock" "struct tm *result"
.Ft time_t
.Fn mktime "struct tm *tm"
+.Ft struct tm *
+.Fn offtime "const time_t *clock" "long offset"
+.Ft struct tm *
+.Fn offtime_r "const time_t *clock" "long offset" "struct tm *result"
.Ft time_t
.Fn timegm "struct tm *tm"
.Sh DESCRIPTION
The
.Fn ctime ,
.Fn gmtime ,
+.Fn localtime ,
and
-.Fn localtime
+.Fn offtime
functions all take as argument a pointer to a time value representing
the time in seconds since the Epoch (00:00:00 UTC on January 1, 1970;
see
@@ -126,6 +133,18 @@
.Vt struct tm .
.Pp
The
+.Fn offtime
+function similarly converts the time value with a time zone adjustment
+corresponding to the provided
+.Fa offset ,
+which is expressed in seconds, with positive values indicating a time
+zone ahead of UTC (east of the Prime Meridian).
+It does not call
+.Xr tzset 3
+or modify
+.Va tzname .
+.Pp
+The
.Fn ctime
function
adjusts the time value for the current time zone in the same manner as
@@ -158,13 +177,15 @@
.Fa buf ,
which must be at least 26 characters long, to store the result in.
The
-.Fn localtime_r
+.Fn localtime_r ,
+.Fn gmtime_r ,
and
-.Fn gmtime_r
+.Fn offtime_r
functions provide the same functionality as
-.Fn localtime
+.Fn localtime ,
+.Fn gmtime ,
and
-.Fn gmtime
+.Fn offtime
respectively, except the caller must provide the output buffer
.Fa result .
.Pp
@@ -357,6 +378,12 @@
.Fn localtime_r
functions have been available since
.Fx 8.0 .
+The
+.Fn offtime
+and
+.Fn offtime_r
+functions were added in
+.Fx 14.0 .
.Sh BUGS
Except for
.Fn difftime ,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 18, 7:10 AM (10 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29889805
Default Alt Text
D39715.id120714.diff (2 KB)
Attached To
Mode
D39715: tzcode: Expose and document offtime() and offtime_r().
Attached
Detach File
Event Timeline
Log In to Comment