[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, debian, updated. upstream/0.9.5.5-717-g0f98819

Michael 'Mickey' Lauer mickey at vanille-media.de
Sat Aug 6 08:18:29 UTC 2011


The following commit has been merged in the debian branch:
commit 24f52e8e00d003115ed3904561cbe9ffa3f329b3
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date:   Sun Sep 13 14:32:45 2009 +0200

    ogsmd: fix SMS timezone being parsed incorrectly for places where GMT<0
    Fixes FSO #476. Patch courtesy "dkogan", thanks a lot!

diff --git a/framework/subsystems/ogsmd/gsm/convert.py b/framework/subsystems/ogsmd/gsm/convert.py
index 696e30a..9019378 100644
--- a/framework/subsystems/ogsmd/gsm/convert.py
+++ b/framework/subsystems/ogsmd/gsm/convert.py
@@ -4,7 +4,8 @@
 The Open GSM Daemon - Python Implementation
 
 (C) 2006 Adam Sampson <ats at offog.org>
-(C) 2008 Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+(C) 2008-2009 Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+(C) 2008 Daniel 'alphaone' Willmann
 (C) 2008 Openmoko, Inc.
 GPLv2 or later
 
@@ -72,8 +73,13 @@ def decodePDUTime(bs):
     year += 1900
   else:
     year += 2000
-  sign = (timezone >> 7) * 2 - 1
-  zone = (timezone & 0x7f) / -4. * sign
+
+  # Timezone sign bit started out as bit 3 of the nibble-swapped byte. We
+  # converted to bcd, so negative timezones are now offset by 10*(1<<3)=80
+  if timezone < 80:
+    zone = timezone / 4
+  else:
+    zone = (timezone - 80) / -4.
 
   # Invalid dates will generate a ValueError here which needs catching in
   # higher levels
@@ -90,11 +96,13 @@ def encodePDUTime(timeobj):
     year = td.year % 100
 
     zone = 0
+    # Timezone sign bit will go to bit 3 of the nibble-swapped byte. Right
+    # now this is an offset of 10*(1<<3)=80
     if tzone < 0:
-        zone = 0x80
+        zone = 80
         tzone = -tzone
 
-    zone |= int(tzone * 4)
+    zone += int(tzone * 4)
     return bcd_encode( [ year/10, year%10, td.month/10, td.month%10,
         td.day/10, td.day%10, td.hour/10, td.hour%10, td.minute/10,
         td.minute%10, td.second/10, td.second%10, zone/10, zone%10 ] )

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list