]> diplodocus.org Git - nmh/blobdiff - sbr/datetime.c
seq_setunseen.c: Flip if-condition so return moves from else block.
[nmh] / sbr / datetime.c
index 09c8332bb622b4b82996a50d37b7dbee0bb36f49..9357532ba2db7a700ed6d126e98161b9eca79482 100644 (file)
@@ -88,8 +88,6 @@ parse_datetime (const char *datetime, const char *zone, bool dst,
        the entire day.  The time fields of the tws struct were
        initialized to 0 by the memset() above. */
     if (items_matched >= 6  ||  items_matched == 3) {
        the entire day.  The time fields of the tws struct were
        initialized to 0 by the memset() above. */
     if (items_matched >= 6  ||  items_matched == 3) {
-        int offset = atoi (zone ? zone : "0");
-
         /* struct tws defines tw_mon over [0, 11]. */
         --tws->tw_mon;
 
         /* struct tws defines tw_mon over [0, 11]. */
         --tws->tw_mon;
 
@@ -106,7 +104,11 @@ parse_datetime (const char *datetime, const char *zone, bool dst,
            - the only flag in tw_flags used is TW_DST
          */
         tws->tw_yday = tws->tw_clock = 0;
            - the only flag in tw_flags used is TW_DST
          */
         tws->tw_yday = tws->tw_clock = 0;
-        tws->tw_zone = 60 * (offset / 100)  +  offset % 100;
+        if (zone) {
+            int offset = atoi(zone);
+            tws->tw_zone = 60 * (offset / 100)  +  offset % 100;
+        } else
+            tws->tw_zone = 0;
         if (dst) {
             tws->tw_zone -= 60;  /* per dlocaltime() */
             tws->tw_flags |= TW_DST;
         if (dst) {
             tws->tw_zone -= 60;  /* per dlocaltime() */
             tws->tw_flags |= TW_DST;
@@ -181,7 +183,7 @@ load_timezones (const contentline *clines) {
                 } else {
                     inform("failed to parse start time %s for %s",
                             params->dtstart,
                 } else {
                     inform("failed to parse start time %s for %s",
                             params->dtstart,
-                            in_standard ? "standard" : "daylight");
+                            in_daylight ? "daylight" : "standard");
                     return NULL;
                 }
                 params = NULL;
                     return NULL;
                 }
                 params = NULL;