From 4a796cf042d7cd180a2f093282195306a54bbdc4 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 20 Nov 2025 10:58:11 +0000 Subject: [PATCH] time.h: const correct tm_zone in struct tm The Base Specifications, Issue 8 incorporated Austin Group Defect 1533 adding long tm_gmtoff (which we already have) and const char *tm_zone, which we have but without const. Adapt our struct. This was tested in an amd64 bulk without fallout and fixes a bunch of compiler warnings from strptime.c r1.32 where gmt[] and utc[] were moved to rodata. https://austingroupbugs.net/view.php?id=1533 ok jca millert --- include/time.h | 4 ++-- lib/libc/time/ctime.3 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/time.h b/include/time.h index 3e1e2b4619e..9252872aba2 100644 --- a/include/time.h +++ b/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.32 2022/10/25 16:30:30 millert Exp $ */ +/* $OpenBSD: time.h,v 1.33 2025/11/20 10:58:11 tb Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -106,7 +106,7 @@ struct tm { int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Saving Time flag */ long tm_gmtoff; /* offset from UTC in seconds */ - char *tm_zone; /* timezone abbreviation */ + const char *tm_zone; /* timezone abbreviation */ }; __BEGIN_DECLS diff --git a/lib/libc/time/ctime.3 b/lib/libc/time/ctime.3 index 0702af3a7f0..44a3a01a22b 100644 --- a/lib/libc/time/ctime.3 +++ b/lib/libc/time/ctime.3 @@ -1,7 +1,7 @@ -.\" $OpenBSD: ctime.3,v 1.49 2025/06/23 13:53:11 millert Exp $ +.\" $OpenBSD: ctime.3,v 1.50 2025/11/20 10:58:11 tb Exp $ .\" .\" -.Dd $Mdocdate: June 23 2025 $ +.Dd $Mdocdate: November 20 2025 $ .Dt CTIME 3 .Os .Sh NAME @@ -241,7 +241,7 @@ includes the following fields: int tm_yday; /* day of year (0 \- 365) */ int tm_isdst; /* is summer time in effect? */ long tm_gmtoff; /* offset from UT in seconds */ - char *tm_zone; /* abbreviation of timezone name */ + const char *tm_zone; /* abbreviation of timezone name */ .Ed .Pp The