[PATCH v3 2/2] timegm.3: Remove recommendation against their use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It was straight after a note that they are nonstandard functions,
which already tells the user that if portability is in mind, they
shouldn't be used, so this recommendation adds nothing in that
sense.

Also, there's a note that timelocal() should _never_ be used, due
to mktime() being identical and in the POSIX standard (it is also
in C99), so this note would also add nothing in that sense.

So the only uses not covered by those other notes are non-portable
uses of timegm(3).  In that scenario, it is an excellent function.

When porting to other systems, it is trivial to port timegm(3)
using only standard C (I didn't test it; use on your own):

// timegm.c
 #include <time.h>

time_t timegm(struct tm *tm)
{
	tm->tm_isdst = 0;
	return mktime(tm) - timezone;
}

Cc: Paul Eggert <eggert@xxxxxxxxxxx>
Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>
---
 man3/timegm.3 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/man3/timegm.3 b/man3/timegm.3
index b848e83e1..0e8528b26 100644
--- a/man3/timegm.3
+++ b/man3/timegm.3
@@ -97,7 +97,6 @@ T}	Thread safety	MT-Safe env locale
 .SH CONFORMING TO
 These functions are nonstandard GNU extensions
 that are also present on the BSDs.
-Avoid their use.
 .SH NOTES
 The
 .BR timelocal ()
-- 
2.33.0




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux