Daylight savings time problem

2008-03-26 Thread Fabio Durieux Lopes
  Hi,

   I'm trying to execute some operations based on a file's time. The 
file's time is actually the file's name (e.g. FILE1_20080326170558).
   So I do this:
   fileTimeInSecs = time.mktime(time.strptime(timeString, 
"%Y%m%d%H%M"))
 
   timeString contains the date part of the file's name. Function 
strptime returns a time_struct, but my problem is that tm_isdst is 
set to 0, and when we enter daylight savings time the file's time is 
off by 1 hour. This time_struct is also read only so I can't change 
tm_isdst to -1.

  Anyone knows how to fix it?

-- 
http://mail.python.org/mailman/listinfo/python-list


Time problem (again)

2008-03-27 Thread Fabio Durieux Lopes
   Hi,

   I'm recreating a date-time based on a string and I have a problem 
when daylight savings time is set (I'm off by 1). So today I forced 
my computer into daylight savings time and debugged it again, but 
this time I noticed something strange.

   This is the documentation from python library reference section 
6.10:

6.10 time -- Time access and conversions
...
daylight 
Nonzero if a DST timezone is defined.
...


And this is what I debugged:
-> fileTimeInSecs = time.mktime(time.strptime(timeString, 
"%Y%m%d%H%M"))
(Pdb) p timeString
'200803271643'
(Pdb) n
> /home/salsa/Projects/TimBR_CDR/fileSync/
fileSynchronizer.py(50)passFilesOlderThan()
-> print time.daylight
(Pdb) 
0

 See how 'print time.daylight' resulted in '0'? Shouldn't it be Non-
zero? Do I have to set something for it to use DST?


 Also, is this the right list to send questions?
 
 





-- 
http://mail.python.org/mailman/listinfo/python-list


Signal problem

2008-03-27 Thread Fabio Durieux Lopes
  Hello again! Full of problems today!

  This one is about signal treatment. I made a daemon and set it to 
treat 2 signals: SIGALRM and SIGTERM.

   It goes like this:
   signal.signal(signal.SIGTERM, daemon.signalHandler)
   signal.signal(signal.SIGALRM, aFilter.alarmHandler)


   On daemon.py I have:
"
...
terminate = False

def signalHandler(signum, frame):
   terminate = True

...
"

   And my main loop goes like this:

   'while(not daemon.terminate):'

   When the signal treatment was in the same file as my loop it 
worked just fine, and since I've separated it in another file it 
stopped working. The SIGALRM treatment, which remains in the same 
file, is still working. Any reason why it doesn't treat SIGTERM 
anymore? Does it have anything to do with the fact that 'terminate' 
is not a class variable? Any ideas?

   Thanks in advance!

-- 
http://mail.python.org/mailman/listinfo/python-list