NetBSD-Users archive

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

tm(3) vs "double leap second"



Hey,

In tm(3) and /usr/include/time.h, we note:

int     tm_sec     Seconds [0, 61]

int     tm_sec;    /* seconds after the minute [0-61] */


In other places (e.g., ctime(3)), we note:

int tm_sec;      /* seconds (0 - 60) */


I believe the notion of tm_sec allowing for 0-61 to
account for a possible "double leap second" was a
mistake as discussed e.g., here:
https://groups.google.com/g/comp.dcom.telecom/c/Qq0lwZYG_fI?hl=en#02dd6ed5bb9ed84e

POSIX currently notes:

int    tm_sec   Seconds [0,60]

"The range [0,60] for tm_sec allows for the occasional
leap second."

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html

I believe this should be updated, but I don't know
whether this is a documentation/comment fix only, or
if we are actually somewhere using a value of 61?

-Jan
Index: include/time.h
===================================================================
RCS file: /cvsroot/src/include/time.h,v
retrieving revision 1.47
diff -u -p -r1.47 time.h
--- include/time.h	4 Oct 2016 09:41:41 -0000	1.47
+++ include/time.h	23 Oct 2022 03:20:17 -0000
@@ -73,7 +73,7 @@ typedef	_BSD_TIMER_T_	timer_t;
 #define CLOCKS_PER_SEC	100
 
 struct tm {
-	int	tm_sec;		/* seconds after the minute [0-61] */
+	int	tm_sec;		/* seconds after the minute [0-60] */
 	int	tm_min;		/* minutes after the hour [0-59] */
 	int	tm_hour;	/* hours since midnight [0-23] */
 	int	tm_mday;	/* day of the month [1-31] */
Index: share/man/man3/tm.3
===================================================================
RCS file: /cvsroot/src/share/man/man3/tm.3,v
retrieving revision 1.4
diff -u -p -r1.4 tm.3
--- share/man/man3/tm.3	14 Apr 2011 05:45:34 -0000	1.4
+++ share/man/man3/tm.3	23 Oct 2022 03:20:17 -0000
@@ -42,7 +42,7 @@ The following standards-compliant fields
 .Bl -column -offset indent \
 "Type" "Field  " "Months since January 1     "  "Range "
 .It Sy Type Ta Sy Field Ta Sy Represents Ta Sy Range
-.It Vt int Ta Va tm_sec Ta Seconds Ta [0, 61]
+.It Vt int Ta Va tm_sec Ta Seconds Ta [0, 60]
 .It Vt int Ta Va tm_min Ta Minutes Ta [0, 59]
 .It Vt int Ta Va tm_hour Ta Hours since midnight Ta [0, 23]
 .It Vt int Ta Va tm_mday Ta Day of the month Ta [1, 31]


Home | Main Index | Thread Index | Old Index