[PATCH 41/59] Refactor enum tz_rule_type

Paul Eggert eggert@cs.ucla.edu
Sun Jan 5 05:57:16 GMT 2025


* time/tzset.c (enum tz_rule_type): Break out into a separate
declaration and add comments.
---
 time/tzset.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/time/tzset.c b/time/tzset.c
index af397d97dd..90ecdf4210 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -40,6 +40,23 @@ weak_alias (__timezone, timezone)
 /* This locks all the state variables in tzfile.c and this file.  */
 __libc_lock_define_initialized (, __tzset_lock)
 
+/* Type of a DST rule date given in a proleptic TZ string.  */
+enum tz_rule_type
+  {
+    /* No DST.  */
+    NO_DST,
+
+    /* Zero-based Julian day counting any Feb. 29, e.g., ",59"
+       for Feb. 29 in leap years, Mar. 1 in nonleap years.  */
+    J0,
+
+    /* One-based Julian day ignoring any Feb. 29, e.g., ",J59" for Mar. 1.  */
+    J1,
+
+    /* Month m, week n, weekday d, e.g., ",M10.5.0" for Oct.'s last Sunday.  */
+    M
+  };
+
 /* This structure contains all the information about a
    timezone given in a proleptic TZ string.  */
 typedef struct
@@ -47,7 +64,7 @@ typedef struct
     const char *name;
 
     /* When to change.  */
-    enum tz_rule_type { NO_DST, J0, J1, M } type; /* Interpretation of:  */
+    enum tz_rule_type type; /* Interpretation of:  */
     unsigned short int m, n, d;	/* Month, week, day.  */
     int secs;			/* Time of day.  */
 
-- 
2.45.2



More information about the Libc-alpha mailing list