Re: Caught out by daylight saving :-(

2009-03-30 Thread Dave Angel
That should work except for the few minutes before or after the daylight-savings-time change. In other words between 1:55 and 2:01am on that particular date, twice a year. During that time you still have to decide what you want to have happen, and then test your program to make sure it matche

Re: Caught out by daylight saving :-(

2009-03-30 Thread CinnamonDonkey
It's not that fancy, but yes I am on windows. It's a script being called by Cruise Control .NET. They pass in a time stamp on the command line, "MMDD HH:MM:SS" and I need to advance it by 5 minutes before writing it back out to STDOUT to fake a source control modification. The process stopped

Re: Caught out by daylight saving :-(

2009-03-30 Thread CinnamonDonkey
Ah, I think I needed to use fromtimestamp() and not utcfromtimestamp (). :-) On 30 Mar, 13:42, CinnamonDonkey wrote: > Hi Chris, > > Thanx for the link... I had already found that. My problem is not > finding information but more understanding it. I've only been > Pythoning for a short while an

Re: Caught out by daylight saving :-(

2009-03-30 Thread Dave Angel
There isn't any right answer. There are two very different ways you can interpret daylight savings time on a time conversion. I suspect you're on Windows, trying to look at an old file's datestamp, and expect it to look like Windows displays it. But Windows isn't even consistent with itself,

Re: Caught out by daylight saving :-(

2009-03-30 Thread CinnamonDonkey
Hi Chris, Thanx for the link... I had already found that. My problem is not finding information but more understanding it. I've only been Pythoning for a short while and I don't fully understand what the documentation is getting at sometimes. Is it saying that I should define a new class inheriti

Re: Caught out by daylight saving :-(

2009-03-30 Thread andrew cooke
these are utilities i use that might help: def parse_utc_date(day, formats=None): ''' Return the epoch for a given UTC date. ''' if day is None: return time() if formats is None: formats = ('%Y-%m-%d %H:%M:%S %Z', '%Y-%m-%d %Z', '%Y-%B-%d %Z') day = day.str

Re: Caught out by daylight saving :-(

2009-03-30 Thread Chris
On Mar 30, 1:47 pm, CinnamonDonkey wrote: > Hi All, > > I had the following bit of code which was working fine until we went > into Daylight saving this weekend, now the result is an hour out. > >     timeString = "20090330 15:45:23" > >     timeFormat = '%Y-%m-%d %H:%M:%S' > >     modificationTim