Use specific time formatting instead of locale '%c'
authorDiane Trout <diane@caltech.edu>
Thu, 13 Dec 2012 19:40:10 +0000 (11:40 -0800)
committerDiane Trout <diane@caltech.edu>
Thu, 13 Dec 2012 19:40:10 +0000 (11:40 -0800)
For some reason under my current configuration the
locale formatter didn't work. Since it's probably better
to actually set a known format for the xml files, I
manually coded the appropriate string parser format.

htsworkflow/pipelines/gerald.py

index e0d84cf49fb21d3f31841ae4857e7780365db5c3..03c7d10e4b15ad9c859387d214361b4bb88d8171 100644 (file)
@@ -104,7 +104,7 @@ class Gerald(Alignment):
 
         timestamp = self.tree.findtext('ChipWideRunParameters/TIME_STAMP')
         if timestamp is not None:
-            epochstamp = time.mktime(time.strptime(timestamp, '%c'))
+            epochstamp = time.mktime(time.strptime(timestamp))
             return datetime.fromtimestamp(epochstamp)
         return super(Gerald, self)._get_date()
     date = property(_get_date)
@@ -187,7 +187,10 @@ class CASAVA(Alignment):
             return None
         time_element = self.tree.xpath('TIME_STAMP')
         if len(time_element) == 1:
-            return datetime.strptime(time_element[0].text, '%c')
+           timetuple = time.strptime(
+               time_element[0].text.strip(),
+               "%a %d %b %Y %I:%M:%S %p")
+           return datetime(*timetuple[:6])
         return super(CASAVA, self)._get_date()
     date = property(_get_date)