]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
time-util: rename variables
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 15 Feb 2023 04:46:50 +0000 (13:46 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 23 Feb 2023 23:55:27 +0000 (08:55 +0900)
No functional changes, just refactoring.

src/basic/time-util.c

index 725bfe9fed6f6e0a6dcd8dd79f330ef9f681bbd5..ea381da8f97630f776d7751589ab4275fe17f15f 100644 (file)
@@ -633,10 +633,10 @@ static int parse_timestamp_impl(const char *t, usec_t *ret, bool with_tz) {
 
         const char *k, *utc = NULL, *tzn = NULL;
         struct tm tm, copy;
-        time_t x;
         usec_t usec, plus = 0, minus = 0;
-        int r, weekday = -1, dst = -1;
+        int r, weekday = -1, isdst = -1;
         unsigned fractional = 0;
+        time_t sec;
 
         /* Allowed syntaxes:
          *
@@ -745,18 +745,18 @@ static int parse_timestamp_impl(const char *t, usec_t *ret, bool with_tz) {
                         if (IN_SET(j, 0, 1)) {
                                 /* Found one of the two timezones specified. */
                                 t = strndupa_safe(t, e - t - 1);
-                                dst = j;
+                                isdst = j;
                                 tzn = tzname[j];
                         }
                 }
         }
 
-        x = (time_t) (usec / USEC_PER_SEC);
+        sec = (time_t) (usec / USEC_PER_SEC);
 
-        if (!localtime_or_gmtime_r(&x, &tm, utc))
+        if (!localtime_or_gmtime_r(&sec, &tm, utc))
                 return -EINVAL;
 
-        tm.tm_isdst = dst;
+        tm.tm_isdst = isdst;
         if (!with_tz && tzn)
                 tm.tm_zone = tzn;
 
@@ -871,11 +871,11 @@ from_tm:
         if (weekday >= 0 && tm.tm_wday != weekday)
                 return -EINVAL;
 
-        x = mktime_or_timegm(&tm, utc);
-        if (x < 0)
+        sec = mktime_or_timegm(&tm, utc);
+        if (sec < 0)
                 return -EINVAL;
 
-        usec = usec_add(x * USEC_PER_SEC, fractional);
+        usec = usec_add(sec * USEC_PER_SEC, fractional);
 
 finish:
         usec = usec_add(usec, plus);