bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] Option to Disable DST


From: Gustavo San Roman
Subject: [bug-gawk] Option to Disable DST
Date: Wed, 7 Sep 2011 09:07:21 -0700 (PDT)

Hi,
 
      I' writing an script that needs to do things for every day in a period, so to increase the day I was doing "DateBegin += 24*60*60" that seemed to work ok, but I noticed some missing and repeated dates in some conditions, tracing the results it happen when the DST comes into effect (or goes away).
 
      The following code gives the correct list, but using the original method (commented), when the DateBegin is "2011 11 06 00 00 00" and I add "24*60*60" became "2011 11 06 23 00 00" and that coincides with the DST change, I have not found any way to disable the DST when adding time to a date or just disabling completely the DST for the script or any other way to add a day to a date.
 
 
      DateBegin = mktime("20111001");
      DateEnd   = mktime("20111122");
     
      # Set the price for each day in each timeframe
      DateList = "";
 
      # generate the list of dates
      do
      {
            DateList = DateList "," strftime("%Y%m%d",DateBegin);
            # DateBegin += 24*60*60;
 
            DateBegin = mktime(strftime("%Y %m %d 00 00 00",DateBegin + 27*60*60)); # this has to be done to avoid the issue of the DST being applied to the date (27 is just to be extra safe).
 
      } while ((DateBegin <= DateEnd) && (DateBegin <= DateHardEnd))
 
      # remove the first comma
      sub(/,/, "", DateList)
 
      print DateList;
 
 
 
Thanks,
---
Gustavo San Roman G.
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]