chansen / c-dt Goto Github PK
View Code? Open in Web Editor NEWLightweight C library for date arithmetic and date conversion using the proleptic Gregorian calendar. Supports conversion between all ISO 8601 dates.
License: Other
Lightweight C library for date arithmetic and date conversion using the proleptic Gregorian calendar. Supports conversion between all ISO 8601 dates.
License: Other
dt_add_quarters(dt_from_ymd(2018, 12, 2), DT_EXCESS))
returns February 4th of next year as result. I would have expected February 2nd. With dt_add_years()
an overflow of one day is detected, if the start date starts in a leap year after February 29th and does not end in a leap year. If only the result year lies in a leap year, the result is undercut by one day. If both the start and finish dates are in a leap year, the result is correct again.
System:
Linux 3.0.0-24-generic #40~lucid1-Ubuntu SMP Wed Jul 25 14:03:01 UTC 2012 x86_64 GNU/Linux
gcc: gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
make all works well.
make test felt . The log is here:
make test
cc -Wall -I. -I.. -c -o t/tap.o t/tap.c
cc -Wall -I. -I.. -c -o t/yd.o t/yd.c
cc -lc t/yd.o dt.o t/tap.o -o t/yd.t
cc -Wall -I. -I.. -c -o t/ymd.o t/ymd.c
cc -lc t/ymd.o dt.o t/tap.o -o t/ymd.t
cc -Wall -I. -I.. -c -o t/ymd_epochs.o t/ymd_epochs.c
cc -lc t/ymd_epochs.o dt.o t/tap.o -o t/ymd_epochs.t
cc -Wall -I. -I.. -c -o t/yqd.o t/yqd.c
cc -lc t/yqd.o dt.o t/tap.o -o t/yqd.t
cc -Wall -I. -I.. -c -o t/ywd.o t/ywd.c
cc -lc t/ywd.o dt.o t/tap.o -o t/ywd.t
cc -Wall -I. -I.. -c -o t/tm.o t/tm.c
cc -lc t/tm.o dt.o t/tap.o -o t/tm.t
cc -Wall -I. -I.. -c -o t/easter_western.o t/easter_western.c
cc -lc t/easter_western.o dt.o t/tap.o -o t/easter_western.t
cc -Wall -I. -I.. -c -o t/easter_orthodox.o t/easter_orthodox.c
cc -lc t/easter_orthodox.o dt.o t/tap.o -o t/easter_orthodox.t
cc -Wall -I. -I.. -c -o t/days_in_year.o t/days_in_year.c
cc -lc t/days_in_year.o dt.o t/tap.o -o t/days_in_year.t
cc -Wall -I. -I.. -c -o t/days_in_month.o t/days_in_month.c
cc -lc t/days_in_month.o dt.o t/tap.o -o t/days_in_month.t
cc -Wall -I. -I.. -c -o t/days_in_quarter.o t/days_in_quarter.c
cc -lc t/days_in_quarter.o dt.o t/tap.o -o t/days_in_quarter.t
cc -Wall -I. -I.. -c -o t/first_day_of_year.o t/first_day_of_year.c
cc -lc t/first_day_of_year.o dt.o t/tap.o -o t/first_day_of_year.t
cc -Wall -I. -I.. -c -o t/first_day_of_quarter.o t/first_day_of_quarter.c
cc -lc t/first_day_of_quarter.o dt.o t/tap.o -o t/first_day_of_quarter.t
cc -Wall -I. -I.. -c -o t/first_day_of_month.o t/first_day_of_month.c
cc -lc t/first_day_of_month.o dt.o t/tap.o -o t/first_day_of_month.t
cc -Wall -I. -I.. -c -o t/first_day_of_week.o t/first_day_of_week.c
cc -lc t/first_day_of_week.o dt.o t/tap.o -o t/first_day_of_week.t
cc -Wall -I. -I.. -c -o t/last_day_of_year.o t/last_day_of_year.c
cc -lc t/last_day_of_year.o dt.o t/tap.o -o t/last_day_of_year.t
cc -Wall -I. -I.. -c -o t/last_day_of_quarter.o t/last_day_of_quarter.c
cc -lc t/last_day_of_quarter.o dt.o t/tap.o -o t/last_day_of_quarter.t
cc -Wall -I. -I.. -c -o t/last_day_of_month.o t/last_day_of_month.c
cc -lc t/last_day_of_month.o dt.o t/tap.o -o t/last_day_of_month.t
cc -Wall -I. -I.. -c -o t/last_day_of_week.o t/last_day_of_week.c
cc -lc t/last_day_of_week.o dt.o t/tap.o -o t/last_day_of_week.t
cc -Wall -I. -I.. -c -o t/next_day_of_week.o t/next_day_of_week.c
cc -lc t/next_day_of_week.o dt.o t/tap.o -o t/next_day_of_week.t
cc -Wall -I. -I.. -c -o t/prev_day_of_week.o t/prev_day_of_week.c
cc -lc t/prev_day_of_week.o dt.o t/tap.o -o t/prev_day_of_week.t
cc -Wall -I. -I.. -c -o t/next_weekday.o t/next_weekday.c
cc -lc t/next_weekday.o dt.o t/tap.o -o t/next_weekday.t
cc -Wall -I. -I.. -c -o t/prev_weekday.o t/prev_weekday.c
cc -lc t/prev_weekday.o dt.o t/tap.o -o t/prev_weekday.t
cc -Wall -I. -I.. -c -o t/nth_day_of_week.o t/nth_day_of_week.c
cc -lc t/nth_day_of_week.o dt.o t/tap.o -o t/nth_day_of_week.t
cc -Wall -I. -I.. -c -o t/add_months.o t/add_months.c
cc -lc t/add_months.o dt.o t/tap.o -o t/add_months.t
t/yd.t .................... Unrecognized character \x7F in column 1 at t/yd.t line 1.
t/yd.t .................... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/ymd.t ................... Unrecognized character \x7F in column 1 at t/ymd.t line 1.
t/ymd.t ................... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/ymd_epochs.t ............ Unrecognized character \x7F in column 1 at t/ymd_epochs.t line 1.
t/ymd_epochs.t ............ Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/yqd.t ................... Unrecognized character \x7F in column 1 at t/yqd.t line 1.
t/yqd.t ................... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/ywd.t ................... Unrecognized character \x7F in column 1 at t/ywd.t line 1.
t/ywd.t ................... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/tm.t .................... Unrecognized character \x7F in column 1 at t/tm.t line 1.
t/tm.t .................... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/easter_western.t ........ Unrecognized character \x7F in column 1 at t/easter_western.t line 1.
t/easter_western.t ........ Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/easter_orthodox.t ....... Unrecognized character \x7F in column 1 at t/easter_orthodox.t line 1.
t/easter_orthodox.t ....... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/days_in_year.t .......... Unrecognized character \x7F in column 1 at t/days_in_year.t line 1.
t/days_in_year.t .......... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/days_in_month.t ......... Unrecognized character \x7F in column 1 at t/days_in_month.t line 1.
t/days_in_month.t ......... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/days_in_quarter.t ....... Unrecognized character \x7F in column 1 at t/days_in_quarter.t line 1.
t/days_in_quarter.t ....... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/first_day_of_year.t ..... Unrecognized character \x7F in column 1 at t/first_day_of_year.t line 1.
t/first_day_of_year.t ..... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/first_day_of_quarter.t .. Unrecognized character \x7F in column 1 at t/first_day_of_quarter.t line 1.
t/first_day_of_quarter.t .. Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/first_day_of_month.t .... Unrecognized character \x7F in column 1 at t/first_day_of_month.t line 1.
t/first_day_of_month.t .... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/first_day_of_week.t ..... Unrecognized character \x7F in column 1 at t/first_day_of_week.t line 1.
t/first_day_of_week.t ..... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/last_day_of_year.t ...... Unrecognized character \x7F in column 1 at t/last_day_of_year.t line 1.
t/last_day_of_year.t ...... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/last_day_of_quarter.t ... Unrecognized character \x7F in column 1 at t/last_day_of_quarter.t line 1.
t/last_day_of_quarter.t ... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/last_day_of_month.t ..... Unrecognized character \x7F in column 1 at t/last_day_of_month.t line 1.
t/last_day_of_month.t ..... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/last_day_of_week.t ...... Unrecognized character \x7F in column 1 at t/last_day_of_week.t line 1.
t/last_day_of_week.t ...... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/next_day_of_week.t ...... Unrecognized character \x7F in column 1 at t/next_day_of_week.t line 1.
t/next_day_of_week.t ...... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/prev_day_of_week.t ...... Unrecognized character \x7F in column 1 at t/prev_day_of_week.t line 1.
t/prev_day_of_week.t ...... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/next_weekday.t .......... Unrecognized character \x7F in column 1 at t/next_weekday.t line 1.
t/next_weekday.t .......... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/prev_weekday.t .......... Unrecognized character \x7F in column 1 at t/prev_weekday.t line 1.
t/prev_weekday.t .......... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/nth_day_of_week.t ....... Unrecognized character \x7F in column 1 at t/nth_day_of_week.t line 1.
t/nth_day_of_week.t ....... Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/add_months.t ............ Unrecognized character \x7F in column 1 at t/add_months.t line 1.
t/add_months.t ............ Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
t/yd.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/ymd.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/ymd_epochs.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/yqd.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/ywd.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/tm.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/easter_western.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/easter_orthodox.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/days_in_year.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/days_in_month.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/days_in_quarter.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/first_day_of_year.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/first_day_of_quarter.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/first_day_of_month.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/first_day_of_week.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/last_day_of_year.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/last_day_of_quarter.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/last_day_of_month.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/last_day_of_week.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/next_day_of_week.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/prev_day_of_week.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/next_weekday.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/prev_weekday.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/nth_day_of_week.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
t/add_months.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
Files=25, Tests=0, 0 wallclock secs ( 0.07 usr + 0.02 sys = 0.09 CPU)
Result: FAIL
I brought this library up at jqlang/jq#1053 (comment) and the question came up on how well it supported tzdata on Windows, BSD/Unix and GNU. Could you shed some light on the matter?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.