1081
Parse string that specifies time zone as offset from UTC.
1085
str - pointer to string which contains offset
1086
length - length of string
1087
offset - out parameter for storing found offset in seconds.
1090
This function parses string which contains time zone offset
1091
in form similar to '+10:00' and converts found value to
1092
seconds from UTC form (east is positive).
1096
1 - String doesn't contain valid time zone offset
1099
str_to_offset(const char *str, uint32_t length, long *offset)
1101
const char *end= str + length;
1111
else if (*str == '-')
1119
while (str < end && my_isdigit(&my_charset_utf8_general_ci, *str))
1121
number_tmp= number_tmp*10 + *str - '0';
1125
if (str + 1 >= end || *str != ':')
1129
offset_tmp = number_tmp * MINS_PER_HOUR; number_tmp= 0;
1131
while (str < end && my_isdigit(&my_charset_utf8_general_ci, *str))
1133
number_tmp= number_tmp * 10 + *str - '0';
1140
offset_tmp= (offset_tmp + number_tmp) * SECS_PER_MIN;
1143
offset_tmp= -offset_tmp;
1146
Check if offset is in range prescribed by standard
1147
(from -12:59 to 13:00).
1150
if (number_tmp > 59 || offset_tmp < -13 * SECS_PER_HOUR + 1 ||
1151
offset_tmp > 13 * SECS_PER_HOUR)
1154
*offset= offset_tmp;
1161
1081
Get Time_zone object for specified time zone.
1163
1083
Not implemented yet. This needs to hook into some sort of OS system call.