diff options
author | Gordon Bergling <gbe@FreeBSD.org> | 2022-09-16 18:38:58 +0000 |
---|---|---|
committer | Gordon Bergling <gbe@FreeBSD.org> | 2022-09-16 18:38:58 +0000 |
commit | 30cfb3c8ee3d3fc79644541207c81d20c72176ce (patch) | |
tree | a8a55e66304b83cae2d20ccf23891fe26267137b | |
parent | e9e615c88a747587292ea38088ce8bf2f7da4792 (diff) | |
download | src-30cfb3c8ee3d3fc79644541207c81d20c72176ce.tar.gz src-30cfb3c8ee3d3fc79644541207c81d20c72176ce.zip |
ctime.3: Add a note about a possible return value of localtime(3)
The localtime(3) function returns a NULL pointer, if the passed in-time
translates to a year that will not fit in an integer type. It is stricly
recommended to check the return value to avoid garage output.
Reported by: mckusick
Reviewed by: mckusick, imp, rpokala
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36515
-rw-r--r-- | contrib/tzcode/stdtime/ctime.3 | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/tzcode/stdtime/ctime.3 b/contrib/tzcode/stdtime/ctime.3 index 771027fa62ec..de3a57bab59e 100644 --- a/contrib/tzcode/stdtime/ctime.3 +++ b/contrib/tzcode/stdtime/ctime.3 @@ -30,7 +30,7 @@ .\" From: @(#)ctime.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 4, 2022 +.Dd September 16, 2022 .Dt CTIME 3 .Os .Sh NAME @@ -94,6 +94,10 @@ and returns a pointer to a (described below) which contains the broken-out time information for the value after adjusting for the current time zone (and any other factors such as Daylight Saving Time). +When the specified time translates to a year that will not fit in an +.Dv int , +.Fn localtime +returns NULL. Time zone adjustments are performed as specified by the .Ev TZ environment variable (see |