Skip to content

Commit

Permalink
Update timelib to 2018.02
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jun 30, 2019
1 parent 07cdf01 commit aae5907
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 69 deletions.
4 changes: 2 additions & 2 deletions ext/date/lib/LICENSE.rst
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2015-2017 Derick Rethans
Copyright (c) 2017 MongoDB, Inc.
Copyright (c) 2015-2019 Derick Rethans
Copyright (c) 2017-2019 MongoDB, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ext/date/lib/astro.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 1 addition & 2 deletions ext/date/lib/astro.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -72,4 +72,3 @@
/* below the horizon. */
#define astronomical_twilight(ts,lon,lat,start,end) \
timelib_astro_rise_set_altitude( ts, lon, lat, -18.0, 0, start, end )

2 changes: 1 addition & 1 deletion ext/date/lib/dow.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ext/date/lib/interval.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion ext/date/lib/parse_date.re
@@ -1,7 +1,8 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ext/date/lib/parse_iso_intervals.re
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 7 additions & 9 deletions ext/date/lib/parse_tz.c
@@ -1,7 +1,8 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -393,7 +394,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
tz->type[0].isgmtcnt
);
for (i = 0; i < tz->bit64.timecnt; i++) {
printf ("%016lX (%20ld) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
printf ("%016" PRIX64 " (%20" PRId64 ") = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
tz->trans[i], tz->trans[i], tz->trans_idx[i],
(long int) tz->type[tz->trans_idx[i]].offset,
tz->type[tz->trans_idx[i]].isdst,
Expand All @@ -404,7 +405,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
);
}
for (i = 0; i < tz->bit64.leapcnt; i++) {
printf ("%016lX (%20ld) = %d\n",
printf ("%016" PRIX64 " (%20ld) = %d\n",
tz->leap_times[i].trans,
(long) tz->leap_times[i].trans,
tz->leap_times[i].offset);
Expand Down Expand Up @@ -502,11 +503,6 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
tmp = timelib_tzinfo_ctor(timezone);

version = read_preamble(&tzf, tmp, &type);
if (version == -1) {
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
timelib_tzinfo_dtor(tmp);
return NULL;
}
if (version < 2 || version > 3) {
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
timelib_tzinfo_dtor(tmp);
Expand All @@ -521,6 +517,7 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
if (!skip_64bit_preamble(&tzf, tmp)) {
/* 64 bit preamble is not in place */
*error_code = TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE;
timelib_tzinfo_dtor(tmp);
return NULL;
}
read_64bit_header(&tzf, tmp);
Expand Down Expand Up @@ -607,8 +604,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
/* If there is no transition time, we pick the first one, if that doesn't
* exist we return NULL */
if (!tz->bit64.timecnt || !tz->trans) {
*transition_time = 0;
if (tz->bit64.typecnt == 1) {
*transition_time = INT64_MIN;
return &(tz->type[0]);
}
return NULL;
Expand All @@ -619,6 +616,7 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
* one in case there are only DST entries. Not sure which smartass came up
* with this idea in the first though :) */
if (ts < tz->trans[0]) {
*transition_time = INT64_MIN;
return &(tz->type[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion ext/date/lib/timelib.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2017 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 6 additions & 5 deletions ext/date/lib/timelib.h
@@ -1,7 +1,8 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -321,9 +322,9 @@ typedef struct _timelib_tzdb {
# define timelib_free free
#endif

#define TIMELIB_VERSION 201801
#define TIMELIB_EXTENDED_VERSION 20180105
#define TIMELIB_ASCII_VERSION "2018.01RC3"
#define TIMELIB_VERSION 201802
#define TIMELIB_EXTENDED_VERSION 20180201
#define TIMELIB_ASCII_VERSION "2018.02"

#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
Expand Down Expand Up @@ -649,7 +650,7 @@ void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info
* It fetches the right UTC offset that is currently stored in the time
* stamp field in 't' ('sse'), and assigns that to the 'z' field and 'dst'
* field (whether DST is in effect at the time). It also sets the current
* abbrevation to the 'tz_addr' field, making sure that if a value was already
* abbreviation to the 'tz_addr' field, making sure that if a value was already
* set it was freed.
*
* The time zone information in 'tz' is *not* duplicated into the 't' field so
Expand Down
13 changes: 2 additions & 11 deletions ext/date/lib/timelib_private.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
* Copyright (c) 2015-2019 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,13 +39,7 @@
# endif
#endif

#ifdef HAVE_STRING_H
# include <string.h>
#endif

#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <string.h>

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
Expand All @@ -68,10 +62,7 @@
#endif

#include <stdio.h>

#if HAVE_LIMITS_H
#include <limits.h>
#endif

#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
Expand Down

0 comments on commit aae5907

Please sign in to comment.