[28/59] Prefer "UTC" for UTC

Message ID 20250105055750.1668721-29-eggert@cs.ucla.edu (mailing list archive)
State New
Headers
Series time: sync mktime from Gnulib |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Paul Eggert Jan. 5, 2025, 5:57 a.m. UTC
  * NEWS: Mention this.
* resolv/ns_date.c, sysdeps/generic/netinet/in_systm.h:
* sysdeps/nptl/pthread.h, time/bits/types/struct_timeb.h:
* time/strftime_l.c, time/sys/time.h, time/tzfile.c, time/tzset.c:
In strings and commentary, prefer "UTC" to "GMT" when referring to
Coordinated Universal Time.  POSIX.1-2024 requires this and other
systems do it this way.
---
 NEWS                               |  5 +++++
 resolv/ns_date.c                   |  2 +-
 sysdeps/generic/netinet/in_systm.h |  2 +-
 sysdeps/nptl/pthread.h             |  2 +-
 time/bits/types/struct_timeb.h     |  2 +-
 time/strftime_l.c                  |  2 +-
 time/sys/time.h                    |  2 +-
 time/tzset.c                       | 10 +++++-----
 8 files changed, 16 insertions(+), 11 deletions(-)
  

Patch

diff --git a/NEWS b/NEWS
index a737a0124b..69a730a72c 100644
--- a/NEWS
+++ b/NEWS
@@ -84,6 +84,11 @@  Deprecated and removed features, and other changes affecting compatibility:
   explicitly because of the executable bit in GNU_STACK, and the stack is
   not already executable.  Instead, loading such objects will fail.
 
+* gmtime and similar functions now use "UTC", not "GMT", to abbreviate
+  Coordinated Universal Time (often called "GMT", though they are not
+  quite the same).  This is more compatible with other platforms and is
+  required by POSIX.1-2024.
+
 * The US daylight saving rule is now the default for incomplete TZ
   strings like TZ="AST4ADT" that use the TZ syntax from circa-1980s
   Unix System V.  Formerly the rule was documented to be that of
diff --git a/resolv/ns_date.c b/resolv/ns_date.c
index 8e94d1c4e8..d931c70df8 100644
--- a/resolv/ns_date.c
+++ b/resolv/ns_date.c
@@ -35,7 +35,7 @@  static int	datepart(const char *, int, int, int, int *);
 
 /*%
  * Convert a date in ASCII into the number of seconds since
- * 1 January 1970 (GMT assumed).  Format is yyyymmddhhmmss, all
+ * 1 January 1970 (UTC assumed).  Format is yyyymmddhhmmss, all
  * digits required, no spaces allowed.
  */
 
diff --git a/sysdeps/generic/netinet/in_systm.h b/sysdeps/generic/netinet/in_systm.h
index cd09598926..1b8b7de710 100644
--- a/sysdeps/generic/netinet/in_systm.h
+++ b/sysdeps/generic/netinet/in_systm.h
@@ -33,7 +33,7 @@  __BEGIN_DECLS
 
 typedef uint16_t n_short;      /* short as received from the net */
 typedef uint32_t n_long;       /* long as received from the net  */
-typedef uint32_t n_time;       /* ms since 00:00 GMT, byte rev   */
+typedef uint32_t n_time;       /* ms since 00:00 UTC, byte rev   */
 
 __END_DECLS
 
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index b643546dc8..5ebfadc2bd 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -1137,7 +1137,7 @@  extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
 /* Wait for condition variable COND to be signaled or broadcast until
    ABSTIME.  MUTEX is assumed to be locked before.  ABSTIME is an
    absolute time specification; zero is the beginning of the epoch
-   (00:00:00 GMT, January 1, 1970).
+   (00:00:00 UTC, January 1, 1970).
 
    This function is a cancellation point and therefore not marked with
    __THROW.  */
diff --git a/time/bits/types/struct_timeb.h b/time/bits/types/struct_timeb.h
index 1fe60c7131..b4939ba4b3 100644
--- a/time/bits/types/struct_timeb.h
+++ b/time/bits/types/struct_timeb.h
@@ -8,7 +8,7 @@  struct timeb
   {
     time_t time;		/* Seconds since epoch, as from 'time'.  */
     unsigned short int millitm;	/* Additional milliseconds.  */
-    short int timezone;		/* Minutes west of GMT.  */
+    short int timezone;		/* Minutes west of UTC.  */
     short int dstflag;		/* Nonzero if Daylight Savings Time used.  */
   };
 
diff --git a/time/strftime_l.c b/time/strftime_l.c
index 584df83d15..2c79eeddae 100644
--- a/time/strftime_l.c
+++ b/time/strftime_l.c
@@ -543,7 +543,7 @@  __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format,
   if (ut)
     {
       if (! (zone && *zone))
-	zone = "GMT";
+	zone = "UTC";
     }
 #endif
 
diff --git a/time/sys/time.h b/time/sys/time.h
index 34ccee0e0e..0eee32bbce 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -51,7 +51,7 @@  __BEGIN_DECLS
    This is obsolete and should never be used.  */
 struct timezone
   {
-    int tz_minuteswest;		/* Minutes west of GMT.  */
+    int tz_minuteswest;		/* Minutes west of UTC.  */
     int tz_dsttime;		/* Nonzero if DST is ever in effect.  */
   };
 #endif
diff --git a/time/tzset.c b/time/tzset.c
index c2575edad9..2bbf8f055b 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -29,7 +29,7 @@ 
 
 #define SECSPERDAY ((__time64_t) 86400)
 
-char *__tzname[2] = { (char *) "GMT", (char *) "GMT" };
+char *__tzname[2] = { (char *) "UTC", (char *) "UTC" };
 int __daylight = 0;
 long int __timezone = 0L;
 
@@ -51,7 +51,7 @@  typedef struct
     unsigned short int m, n, d;	/* Month, week, day.  */
     int secs;			/* Time of day.  */
 
-    int offset;			/* Seconds east of GMT (west if < 0).  */
+    int offset;			/* Seconds east of UTC (west if < 0).  */
 
     /* We cache the computed time of change for a
        given year so we don't have to recompute it.  */
@@ -449,7 +449,7 @@  compute_change (tz_rule *rule, long long int year)
   if (rule->computed_for == year)
     return;
 
-  /* First set T to January 1st, 0:00:00 GMT in YEAR.  */
+  /* First set T to YEAR-01-01 00:00:00 UT.  */
   t = (((year - 1970) * 365
 	/* Compute the number of leap days between 1970 and YEAR (exclusive).
 	   There is a leap day every 4th year ...  */
@@ -521,7 +521,7 @@  compute_change (tz_rule *rule, long long int year)
       break;
     }
 
-  /* T is now the Epoch-relative time of 0:00:00 GMT on the day we want.
+  /* T is now the Epoch-relative time of 00:00:00 UT on the day we want.
      Just subtract the UT offset and add the time of day, and we're done.  */
 
   rule->change = t - rule->offset + rule->secs;
@@ -611,7 +611,7 @@  __tz_convert (__time64_t timer, int use_localtime, struct tm *tp)
       if (! use_localtime)
 	{
 	  tp->tm_isdst = 0;
-	  tp->tm_zone = "GMT";
+	  tp->tm_zone = "UTC";
 	  tp->tm_gmtoff = 0L;
 	}