openembedded/conf/tinder.conf:
authorHolger Freyther <zecke@selfish.org>
Sat, 30 Jul 2005 19:21:18 +0000 (19:21 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Sat, 30 Jul 2005 19:21:18 +0000 (19:21 +0000)
    -Document the TINDER_TZ Option. It can either be Europe/Berlin (no kidding)
     or a timedelty (e.g. +0200)
openembedded/classes/tinderclient.bbclass:
    -Send timenow as UTC + TINDER_TZ offset
    -Parse and send starttime as time + UTC
     (either set TINDER_START with gmtime or use the most recent
      bitbake from trunk for having BUILDSTART as UTC time)

classes/tinderclient.bbclass
conf/tinder.conf

index c424797..5b55589 100644 (file)
@@ -1,6 +1,26 @@
-def tinder_tinder_time():
-    import time
-    return time.strftime('%m/%d/%Y %H:%M:%S', time.localtime())
+def tinder_tz_offset(off):
+    # get the offset. Either it is a number like
+    # +200 or -300
+    try:
+        return int(off)
+    except ValueError:
+        if off == "Europe/Berlin":
+            return 200
+        else:
+            return 0
+
+def tinder_tinder_time(offset):
+    import datetime
+    td   = datetime.timedelta(tinder_tz_offset(offset))
+    time = datetime.datetime.utcnow() + td
+    return time.strftime('%m/%d/%Y %H:%M:%S')
+
+def tinder_tinder_start(date,offset):
+    import datetime, time
+    td   = datetime.timedelta(tinder_tz_offset(offset))
+    ti   = time.strptime(date, "%m/%d/%Y %H:%M:%S")
+    ti   = datetime.datetime(*ti[0:7])-td
+    return time.strftime('%m/%d/%Y %H:%M:%S')
 
 def tinder_send_email(da, header, log):
     import smtplib
@@ -33,11 +53,11 @@ def tinder_prepare_mail_header(da, status):
     from bb import data
 
     str  = "tinderbox: administrator: %s\n" % data.getVar('TINDER_ADMIN', da, True)
-    str += "tinderbox: starttime: %s\n"     % data.getVar('BUILDSTART', da, True) or data.getVar('TINDER_START', da, True)
+    str += "tinderbox: starttime: %s\n"     % tinder_tinder_start(data.getVar('TINDER_START', da, True) or data.getVar('BUILDSTART', da, True), data.getVar('TINDER_TZ', da, True))
     str += "tinderbox: buildname: %s\n"     % data.getVar('TINDER_BUILD', da, True)
     str += "tinderbox: errorparser: %s\n"   % data.getVar('TINDER_ERROR', da, True)
     str += "tinderbox: status: %s\n"        % status
-    str += "tinderbox: timenow: %s\n"       % tinder_tinder_time()
+    str += "tinderbox: timenow: %s\n"       % tinder_tinder_time(data.getVar('TINDER_TZ', da, True))
     str += "tinderbox: tree: %s\n"          % data.getVar('TINDER_TREE', da, True)
     str += "tinderbox: buildfamily: %s\n"   % "unix"
     str += "tinderbox: END"
index 3d65dcb..c5d523f 100644 (file)
@@ -30,6 +30,9 @@ INHERIT          += "tinderclient"
 #TINDER_SENDLOG    = "http"
 
 
+# TimeZone handling
+#TINDER_TZ         = "+0200"
+
 # Do a report at all
 #TINDER_REPORT     = "1"