[41/59] Refactor enum tz_rule_type

Message ID 20250105055750.1668721-42-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
  * 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(-)
  

Patch

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.  */