[SBI] fix the timezone string converter (#1376)
This commit is contained in:
parent
420c1d5ad3
commit
e3fa731c4a
|
@ -268,13 +268,11 @@ int ogs_strftimezone(char *str, size_t size, int tm_gmtoff)
|
|||
}
|
||||
|
||||
len = ogs_snprintf(str, size, "%c%02d:%02d",
|
||||
off_sign, off / 3600, off % 3600);
|
||||
|
||||
off_sign, off / 3600, (off % 3600) / 60);
|
||||
if (len != 6) {
|
||||
ogs_warn("Unknown tm_gmtoff[%d:%d]", tm_gmtoff, off);
|
||||
|
||||
len = ogs_snprintf(str, size, "%c%02d:%02d",
|
||||
off_sign, (off / 3600) % 100, (off % 3600) % 100);
|
||||
ogs_fatal("Unknown tm_gmtoff[%d:%d], len[%d], str[%s]",
|
||||
tm_gmtoff, off, len, str);
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
||||
return len;
|
||||
|
|
|
@ -489,6 +489,10 @@ static void sbi_message_test5(abts_case *tc, void *data)
|
|||
ABTS_STR_EQUAL(tc, "+08:00", str);
|
||||
ogs_free(str);
|
||||
|
||||
str = ogs_sbi_timezone_string(12600);
|
||||
ABTS_STR_EQUAL(tc, "+03:30", str);
|
||||
ogs_free(str);
|
||||
|
||||
str = ogs_sbi_timezone_string(0);
|
||||
ABTS_STR_EQUAL(tc, "+00:00", str);
|
||||
ogs_free(str);
|
||||
|
|
Loading…
Reference in New Issue