X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Ftime-dst.c;h=afc893cccc95cdbd664ea4b6a53ab71da4ee7082;hb=518dc5dff557116db3f072eb9d0a9492b6226778;hp=8f3cafd5eb8064c62b33ad556decb2923f211c4f;hpb=b7f1542c8be4f02b2c3673f0e08a0749c6e145b5;p=elogind.git diff --git a/src/shared/time-dst.c b/src/shared/time-dst.c index 8f3cafd5e..afc893ccc 100644 --- a/src/shared/time-dst.c +++ b/src/shared/time-dst.c @@ -83,7 +83,7 @@ static inline int64_t decode64(const void *ptr) { int time_get_dst(time_t date, const char *tzfile, time_t *switch_cur, char **zone_cur, bool *dst_cur, - time_t *switch_next, char **zone_next, bool *dst_next) { + time_t *switch_next, int *delta_next, char **zone_next, bool *dst_next) { time_t *transitions = NULL; size_t num_transitions = 0; unsigned char *type_idxs = 0; @@ -102,7 +102,7 @@ int time_get_dst(time_t date, const char *tzfile, size_t tzspec_len; size_t num_leaps; size_t lo, hi; - int err = 0; + int err = -EINVAL; f = fopen(tzfile, "re"); if (f == NULL) @@ -321,8 +321,11 @@ found: *zone_cur = strdup(&zone_names[types[type_idxs[i - 1]].idx]); if (dst_cur) *dst_cur = types[type_idxs[i-1]].isdst; + if (switch_next) *switch_next = transitions[i]; + if (delta_next) + *delta_next = (types[type_idxs[i]].offset - types[type_idxs[i-1]].offset) / 60; if (zone_next) *zone_next = strdup(&zone_names[types[type_idxs[i]].idx]); if (dst_next)