All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 1/3] smsutil: Change the range of time zone
Date: Tue, 30 Nov 2010 18:44:48 +0800	[thread overview]
Message-ID: <1291113890-24465-1-git-send-email-yang.gu@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

---
 src/smsutil.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index b06e9bf..644e3e0 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -51,6 +51,13 @@
 #define SMS_ADDR_FMT "%24[0-9A-F]"
 #define SMS_MSGID_FMT "%40[0-9A-F]"
 
+/*
+ * Time zone accounts for daylight saving time, and the two extreme time
+ * zones on earth are UTC-12 and UTC+14.
+ */
+#define MAX_TIMEZONE 56
+#define MIN_TIMEZONE -48
+
 static GSList *sms_assembly_add_fragment_backup(struct sms_assembly *assembly,
 					const struct sms *sms, time_t ts,
 					const struct sms_address *addr,
@@ -339,7 +346,7 @@ gboolean sms_encode_scts(const struct sms_scts *in, unsigned char *pdu,
 	if (in->second > 59)
 		return FALSE;
 
-	if ((in->timezone > 12*4-1) || (in->timezone < -(12*4-1)))
+	if ((in->timezone > MAX_TIMEZONE) || (in->timezone < MIN_TIMEZONE))
 		return FALSE;
 
 	pdu = pdu + *offset;
@@ -426,7 +433,7 @@ gboolean sms_decode_scts(const unsigned char *pdu, int len,
 	if (oct & 0x08)
 		out->timezone = out->timezone * -1;
 
-	if ((out->timezone > 12*4-1) || (out->timezone < -(12*4-1)))
+	if ((out->timezone > MAX_TIMEZONE) || (out->timezone < MIN_TIMEZONE))
 		return FALSE;
 
 	return TRUE;
-- 
1.7.2.3


             reply	other threads:[~2010-11-30 10:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30 10:44 Yang Gu [this message]
2010-11-30 10:44 ` [PATCH 2/3] Make timezone an optional field Yang Gu
2010-12-08 14:05   ` Denis Kenzior
2010-11-30 10:44 ` [PATCH 3/3] stk: Handle provide local info proactive command Yang Gu
2010-11-30 20:43   ` Jeevaka.Badrappan
2010-12-01  2:03     ` Gu, Yang
2010-12-08 14:05   ` Denis Kenzior
2010-12-07 13:39 ` [PATCH 1/3] smsutil: Change the range of time zone Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291113890-24465-1-git-send-email-yang.gu@intel.com \
    --to=yang.gu@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.