summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: Add format listing testP. J. McDermott2022-03-204-1/+107
|
* main: Replace strtol() calls with sscanf()P. J. McDermott2022-03-203-27/+9
|
* Add --disable-tests to shrink executable sizeP. J. McDermott2022-03-205-11/+58
|
* TODO: Add tasksP. J. McDermott2022-03-201-0/+7
|
* main: Update copyright years in version outputP. J. McDermott2022-03-191-1/+1
|
* datetime: Sanity check parsing resultsP. J. McDermott2022-03-192-12/+37
| | | | | | | | | | | | | | | | | | | Previously, "0000 1970-01-01" was parsed as 00:00:19 70-01-01. Fixes: not ok 614 - 0000 1970-01-01 FAIL: tests/parse.sh 614 - 0000 1970-01-01 # Failed test '0000 1970-01-01' # got: '-59958143981' # expected: '0' ok 615 - 1970/01/01 0000 PASS: tests/parse.sh 615 - 1970/01/01 0000 not ok 616 - 0000 1970/01/01 FAIL: tests/parse.sh 616 - 0000 1970/01/01 # Failed test '0000 1970/01/01' # got: '-59958143981' # expected: '0'
* datetime: Add function to get seconds since EpochP. J. McDermott2022-03-193-14/+26
| | | | And use it in main().
* datetime: Update new _datetime_normalize() callP. J. McDermott2022-03-191-1/+1
|
* main: Pass NULL to time()P. J. McDermott2022-03-191-2/+2
| | | | | | | | | | | | | | If the argument points outside the accessible address space, Linux's time() system call returns a negative value. [1] But since this is indistinguishable from a successful report that the time is before the Epoch, glibc never actually sets errno. The Linux man-pages project recommends: "The tloc argument is obsolescent and should always be NULL in new code. When tloc is NULL, the call cannot fail." [2] [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/time/time.c [2]: https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man2/time.2?id=300c07ddd873fa1abbff96262ec365271e429dab
* Merge branch 'feature/tests'P. J. McDermott2022-03-1911-38/+1077
|\
| * tests: Print format listing as TAP diagnosticsP. J. McDermott2022-03-191-3/+7
| |
| * main: Populate day of week in "now" timeP. J. McDermott2022-03-191-28/+33
| | | | | | | | Needed for format listing.
| * main: Allow faking current timeP. J. McDermott2022-03-192-20/+62
| | | | | | | | Drop use of faketime in tests.
| * datetime: Get now (struct tm) from callerP. J. McDermott2022-03-183-19/+18
| |
| * datetime: Move & unify time() & localtime() callsP. J. McDermott2022-03-181-6/+3
| |
| * tests: Use @'s -F option to auto test all fmtsP. J. McDermott2022-03-171-79/+20
| |
| * tests: WIP parse testP. J. McDermott2022-03-171-7/+103
| |
| * tests: Add (stub) parse testP. J. McDermott2022-03-174-1/+40
| |
| * tests/aux/tap-functions.sh: Drop `set -x`P. J. McDermott2022-03-171-2/+0
| |
| * tests/aux/tap-functions.sh: New file from AutomakeP. J. McDermott2022-03-172-1/+233
| | | | | | | | https://git.savannah.gnu.org/cgit/automake.git/plain/t/ax/tap-functions.sh
| * build-aux/tap-driver.sh: New file from AutomakeP. J. McDermott2022-03-174-1/+662
| | | | | | | | https://git.savannah.gnu.org/cgit/automake.git/plain/lib/tap-driver.sh
| * main: Add undocumented debugging optionP. J. McDermott2022-03-172-4/+29
| | | | | | | | | | Prints the number of seconds between the UNIX epoch and the specified time.
* | README: Fix number of formatsP. J. McDermott2022-03-181-1/+1
| |
* | datetime: Try time-only formats only onceP. J. McDermott2022-03-181-1/+10
|/
* .gitignore: Exclude *SUMSP. J. McDermott2022-03-171-0/+2
|
* TODO: Add tasksP. J. McDermott2022-03-171-0/+3
|
* main: Make (struct option) variable static constP. J. McDermott2022-03-171-1/+1
|
* main: Use difftime() instead of comparing time_tP. J. McDermott2022-03-162-6/+7
| | | | | | | | | | C99 ยง 7.23.1 defines time_t as an "arithmetic [type] capable of representing times" with "implementation-defined" "range and precision of times representable". It doesn't require that time1 > time0 for time1 later than time0. See also: http://computer-programming-forum.com/47-c-language/8d7dec65bd1ddafe.htm
* TODO: New fileP. J. McDermott2022-03-161-0/+2
|
* README: Compare to related programsP. J. McDermott2021-09-011-0/+7
|
* main: Skip empty formatsP. J. McDermott2021-09-011-0/+9
| | | | | | This was previously done in _datetime_strftime() but in a way that would overflow the array if an empty format was at the end. Moving this logic into the caller is safer and makes a little more sense.
* datetime: Collapse spaces after strftime()P. J. McDermott2021-09-012-24/+33
| | | | Turns "Sep 1" into "Sep 1".
* NEWS, configure.ac: Set version to 1.0.0P. J. McDermott2021-08-312-2/+2
|
* datetime: Free fmt bufs when iterators reach endP. J. McDermott2021-08-312-33/+22
| | | | Simplifies caller code.
* datetime: Replace %d with %e in some formatsP. J. McDermott2021-08-311-12/+12
|
* Add option to list supported formatsP. J. McDermott2021-08-314-14/+204
|
* datetime: Find ends of arrays with sizeof()P. J. McDermott2021-08-311-10/+12
| | | | | | | | | | | | Before: $ wc -c @ 61256 @ After: $ wc -c @ 60616 @
* datetime: Add UNIX-like date formatP. J. McDermott2021-08-312-1/+4
|
* main: Handle optionsP. J. McDermott2021-08-312-3/+96
|
* datetime: Add missing #include in headerP. J. McDermott2021-08-311-0/+2
|
* main: Fix exit status on buffer alloc failureP. J. McDermott2021-08-311-1/+1
| | | | Fixes an issue in code moved in commit ad183ca4.
* README: Add more examplesP. J. McDermott2021-08-301-0/+2
|
* datetime: Replace goto with function callsP. J. McDermott2021-08-301-66/+72
| | | | | goto is fine, but this splits up a function that had grown a little long.
* datetime: Replace unnecessary fprintf with fputsP. J. McDermott2021-08-301-1/+1
|
* datetime: Replace large list of formatsP. J. McDermott2021-08-303-832/+131
|
* README: Document formats and Git repositoryP. J. McDermott2021-08-301-0/+89
| | | | | | | | | | | | | | | | | | | | Count the formats using: grep '^".*",$' src/datetime-formats.c | wc -l List the date formats using: sed -n 's|^/\* \(.*\) \*/$|\1|p' src/datetime-formats.c (But ignore 'Time only', 'ISO 8601: 1969-12-31 delimited by "T"', 'ISO 8601: 19691231 delimited by "T"', and '19691231'.) Math to 704: 43 (date formats) * 2 (positions: before or after time) = 86 86 + 1 (time-only no-date format) = 87 87 * 8 (time formats) = 696 696 + 8 (special formats) = 704
* datetime: Drop ambiguous delimiter-less formatsP. J. McDermott2021-08-301-4/+0
| | | | | "20210920210920" could be parsed as either 2021-09-20 21:09:20 or 20:21:09 2021-09-20.
* build: Drop unnecessary $(DATA)P. J. McDermott2021-08-291-1/+1
|
* datetime: Support weekday-only datesP. J. McDermott2021-08-292-2/+36
|
* datetime: Init all relevant struct tm membersP. J. McDermott2021-08-291-4/+11
|