diff options
author | Hiro <Hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-10 08:38:30 +0000 |
---|---|---|
committer | Hiro <Hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-10 08:38:30 +0000 |
commit | 57940797b47f21c2a5f54b6d12abad9553e0e0f9 (patch) | |
tree | 191d890f991b4748202375f47ce8115744bde2de /libsylph/utils.c | |
parent | d19d2c5d8874b947abc80b7aa29c7b19909006f7 (diff) |
fixed crashes on abnormal date.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@628 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r-- | libsylph/utils.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c index f9ebba5a..0ddae386 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3175,11 +3175,14 @@ time_t remote_tzoffset_sec(const gchar *zone) time_t tzoffset_sec(time_t *now) { - struct tm gmt, *lt; + struct tm gmt, *tmp, *lt; gint off; - gmt = *gmtime(now); + tmp = gmtime(now); + g_return_val_if_fail(tmp != NULL, -1); + gmt = *tmp; lt = localtime(now); + g_return_val_if_fail(lt != NULL, -1); off = (lt->tm_hour - gmt.tm_hour) * 60 + lt->tm_min - gmt.tm_min; @@ -3204,12 +3207,15 @@ time_t tzoffset_sec(time_t *now) gchar *tzoffset(time_t *now) { static gchar offset_string[6]; - struct tm gmt, *lt; + struct tm gmt, *tmp, *lt; gint off; gchar sign = '+'; - gmt = *gmtime(now); + tmp = gmtime(now); + g_return_val_if_fail(tmp != NULL, NULL); + gmt = *tmp; lt = localtime(now); + g_return_val_if_fail(lt != NULL, NULL); off = (lt->tm_hour - gmt.tm_hour) * 60 + lt->tm_min - gmt.tm_min; |