Commit Graph

81 Commits

Author SHA1 Message Date
Max Kellermann 2ce8310448 time/Convert: forward-declare struct tm 2024-06-25 20:33:13 +02:00
Max Kellermann 50f0163f5f time/SystemClock: pass by value 2023-09-12 09:56:06 +02:00
Max Kellermann d45994268f system/PeriodClock: move to time/ 2023-03-07 12:08:44 +01:00
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann d6d0f78e93 release v0.23.10
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmNJ2e0NHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFEjBYEACk4QtVnD52sGtz0CwThFYzekvkZHOBcP2fYOH7
 rVcQaNmV7Fpnv+iz+k7zrqhs/A8FgQq6KUNpUn3gzxae4KsA7i1yEpopIqfzRh71
 eVrjTGijMirddehsxKbkjZ1TZy5S+SkZ+Bu965qzXUZuIrErKm4m5xqkIxXBHMEc
 twK9BSCqlTT2vpND5cmX90T/NBDgZd3uQxQP2ohWjVXvg9ou2gtns18ZdYUVRTym
 rLqRLfx1rG1lS8hzKqUqt9YxbWSD606T4giC2vYg2+2OFA9VFh3TNCSaFgWEJMZe
 ou6iaX+aSoCP+H6nktxfYravwdmHvBseRtrOouxPd8Br2k1eSQGXEVlZVTKrpBME
 OZnncEGqN27GggYH1RyVZ6showJ7G05HOhGFDDs8ABR0EbAbNkGvhrjl8cGXONYH
 ScTBbvqkTrhRMOOSmiAp7X1eLJ4QICAfhCV85YzSV93u69egO1MQLYzVYUurOOyt
 TuT+XbUD+Irk3DrHvhxs/IE+ciIvilFsvCmeNjCAyH4ZPvvHt/AIskQNyF3Jj720
 XKjtq6rMF9bizut/kboPgsVQoFbnj7ncCaIZ90h27obeqqiXajTx7ixJldvwDbrp
 yKQY6xDdm7DZChqYF0KKWWzLt2BoAzqVPW3zgRfJRqb9HtQ+ZVJuljvV8bBVFKN1
 zIA4Nw==
 =GQl1
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.10'

release v0.23.10
2022-10-14 23:56:33 +02:00
Max Kellermann 3e25916b37 time/Parser: remove unused library 2022-09-30 18:17:03 +02:00
Max Kellermann bc3415ce8b Copyright year 2022 2022-06-30 09:41:53 +02:00
Max Kellermann 8333927737 time/Zone: add native Windows implementation 2022-06-01 22:35:04 +02:00
Max Kellermann af3a625f64 time/Convert: move GetTimeZoneOffset() to Zone.cxx 2022-02-14 09:21:10 +01:00
August2111 3c3c3eeeca MSVC: use winsock2.h instead of sys/time.h for struct timeval 2021-12-08 19:45:03 +01:00
Max Kellermann 31c7151580 time/Calendar: add DaysInYear() 2021-12-08 19:44:31 +01:00
Rosen Penev 6ec5089cc9 remove std::make_pair
make_pair is an old C++98 function that can be replaced by modern
shorter constructs.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-09-07 21:13:22 -07:00
Max Kellermann a2387210bf time/FileTime: move code to SystemClock.hxx 2021-08-10 19:53:53 +02:00
Max Kellermann d7e7adb496 time/FileTime: add ChronoToFileTime() 2021-08-10 16:16:15 +02:00
Max Kellermann 45354a421c time/FileTime: preserve the FILETIME resolution
Don't truncate the FILETIME to second resolution to pass it to
std::chrono::system_clock::from_time_t(); instead, calculate the
offset between the FILETIME epoch and the
std::system_clock::time_point epoch, and use that to initialize the
time_point directly.
2021-08-10 15:16:59 +02:00
Max Kellermann 9fc3c60910 time/FileTime: add FileTimeToChronoDuration() 2021-08-10 15:13:22 +02:00
Max Kellermann 1976003e91 time/FileTime: allow negative times 2021-08-10 15:13:16 +02:00
Max Kellermann 488afc47d4 time/FileTime: use uint_least64_t 2021-08-10 15:12:49 +02:00
Max Kellermann ef1acb4e2f Merge branch 'v0.22.x' 2021-03-04 18:56:29 +01:00
Érico Rolim 8d80280ab9 time/ISO8601: don't use glibc extension in strptime.
Per the manual for strptime, %F is equivalent %Y-%m-%d, so use that
directly.
2021-03-04 17:49:51 +01:00
Max Kellermann 6cdb3ff21e use [[gnu::pure]] instead of gcc_pure
This is semi-standard and doesn't require the util/Compiler.h header.
2021-02-12 18:34:16 +01:00
Max Kellermann 01af2778ab time/ISO8601: throw std::invalid_argument on error
Throwing std::runtime_error was slightly wrong.
2021-02-12 18:31:56 +01:00
Max Kellermann 16074c565f time/ClockCache: new library 2020-12-01 20:22:26 +01:00
Max Kellermann 0c28d8dcbe time/ISO8601: support YYYY-MM (without day of month) 2020-11-30 21:55:12 +01:00
Max Kellermann 764eaadd25 time/Math: new library 2020-11-30 21:55:05 +01:00
Max Kellermann a2f42e6424 time/ISO8601: use <cstdlib> 2020-07-23 16:26:18 +02:00
Max Kellermann 12b97bbe38 release v0.21.22
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl6GCWgQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEvkQD/9qg6cnCgCKSOmTjteJu1ayeXBMDiL3cCCg
 AwarHQoxsB0102NpV+MLka+4HIwHn+WNL55TzYgfbSh0nfmnki2fZ0YpsZoQR79w
 MP11iMPnFH1oKqj58minBkFNmAis2aLYHJGKaQNUh7wcf0WhbVTqtWBUrKb07RQ0
 Zj5lXtg65O/+yaCVdQGS6fMk2t7CqBM+S3RmbXCib/JRMC6aozoC7nWPvj8b2R8d
 PgxwKMRzyslyFoxDQZrusDjJ1piyigzUMMr32yzYDED4Xr8jsEELaJfULbr6qWT2
 ZNYF91e+D5V7riASAtlFTaVMaISx4QbHjKWR5Xcx0q/SJPAXTxF8RrAqGvqpWYmc
 kqmC8iNxQsW5o3sNhI9qg6sOkq2dIu43VasRCvuo19GABR36wwTK5ORoazIi8fbU
 /Ki/oZHtZczHRop9Cd6698Qr9jyTPdIs55FbgejzrVADvAmslqtcA6XxCBuG1nSF
 Qo48dp9Px7J74qNNuDt5/xLnQGJKaW60/BXrMK9G9QG4x9r4zuCayDO6Qc7FMWWR
 DG7k9nYoXJU5YG7xp9Rk+Yj3Ade8kqhTnKfqw0f2JfkLt0ChPG+rZcxICWSdzZm0
 AfHxuEQlwKaaFHFEsZhVehlsXkeU9OVywo+QDzmY2uqQ2ddlBZ47Qm2MWgTsv8i/
 euVsrzLtag==
 =EedX
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.22'

release v0.21.22
2020-04-02 18:02:10 +02:00
Max Kellermann 672bc3ab67 time/Convert: fix GetTimeZoneOffset() on Windows
Was using the wrong parameter.
2020-04-01 16:21:29 +02:00
Rosen Penev a2f5a63bbc
replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Rosen Penev 2db8bcc353
replace stddef.h with cstddef
The former is deprecated with C++14. The standard says both are the same:

The contents and meaning of the header<cstddef>are the same as the C
standard library header<stddef.h>,except that it does not declare the type
wchar_t, that it also declares the type byte and its associated
operations (21.2.5), and as noted in 21.2.3 and 21.2.4.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:38 -07:00
Rosen Penev ab9f5d2067
replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Max Kellermann 01632d37ef Merge branch 'v0.21.x' 2020-03-12 08:11:08 +01:00
Thomas Klausner d5468dfe89 Add missing header.
Fixes
../src/time/ISO8601.cxx:67:24: error: use of undeclared identifier 'strtoul'
        unsigned long value = strtoul(s, &endptr, 10);
                              ^
../src/time/ISO8601.cxx:77:14: error: use of undeclared identifier 'strtoul'
                        minutes = strtoul(s, &endptr, 10);
                                  ^

on NetBSD with clang 9.0.0.
2020-02-29 10:04:54 +01:00
Max Kellermann 803a48e96d release v0.21.18
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl4CKwwQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEp46D/9q1pRkhYzCyZPQGX967UPoV+Bc1YMX4o2U
 Uh/HqQrKKRAK9goaxu9yMKBIFCbzj6WEZou+/uMEf6ZwXuRcnJMobrUU4+G9Yu3r
 FzlQPW870DyOhk2PWHF8CW3oMt/YH05b6nYNo2ocRnX69/oqL1G7ukbF2Pz3TPc0
 0uNQYYERdMawNCEi1OarzziR6DKuiN+MtZRgUQVacAsoUirwWGNJuaGSDtc3MMM7
 YhgKVmd9XsgVr7fykArj6PLsm2iyXJP5nDB/tIqmwMpQFyhuLUnGOMfhCq02em+r
 47LGvmZiSS/9F2JzPU8EL2yzYdBe4QvU6Ol5SfXbom11MZc3Ty502g2jUXVHjCeo
 1FljCPHbarTmKhvUc0xQXA9i6exZ0wwtxL+Zv7ZQKquRPAhq8E07qkQpdaTWa6vn
 3RfilLE1B/GCgoT6D1+zABxdJ1HRLT7tzFob2kkCccxguK3j2JjCUIkSgM6IY0yv
 a6sMEXbqa+Lh8jggs9ksoT6O+T2HHEr3tEfpFHY+t0NFRfwHd9aX9bNjK+Ji0n51
 YBf2FCb2EBrMAWNZmEnq+TuKX0HASDtoAXTviRKqBXtEG5V8MdAt4PPICCb+bkDr
 psIuYcGeK3vofvq1SwEC7h7gCvsBK5w17/oE2/jYcZLo12H1IdHe5gMP3OUhjel5
 BRi6rLlkYw==
 =XXXs
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.18'

release v0.21.18
2019-12-24 16:31:06 +01:00
Max Kellermann d27e534a85 time/ISO8601: fix Windows build failure
Caused by 2bc127bb43
2019-12-24 16:12:52 +01:00
Max Kellermann 744bd1eadc time/ISO8601: refactor ParseTimeOfDay() to parse one by one
This prepares the migration away from strptime() for Windows
portability.

But the real reason I'm doing this is that strptime() on Apple is
buggy: strptime("14", "%H%M%S") (without separating colons) succeeds
even though only the hour has been parsed.  This fixes recent Travis
failures in the ParseISO8601() unit test.
2019-12-24 10:15:03 +01:00
Max Kellermann 2bc127bb43 time/ISO8601: move code to ParseTimeOfDay() 2019-12-24 10:15:01 +01:00
Max Kellermann 683d5848f4 release v0.21.17
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl34Bg0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEmOvD/4/gBb1kIOQduz+ZV79LHPGeqDoIJBm8VWg
 t9R1Mpt0flqC8+RcXFK/P0kUifBO5fu+a1DbHHijUvDNLYpUsCiXyxTpES9gGh54
 7djEeqi1suoLpMUt4zkUEHGTp2dGUTmyewE1TuF1sZi2xlPgOeWXEX7a0xWs4zdG
 WI4CojUSkQGVAI2XZ7xIKP1v368B9F6AbqTK4zkzjNbTCv5VfESGlxdde0NXqU2e
 /bjil1aT2kdcks3ddeT4llyGIUzn1PzOyA6LQvmVXLSAtz9Rr/hHA+qkR19a4CCt
 PXxE0xClhhmZglzPuES0sRqBbwG99dPzA1ajTOtielwMrlFx+OceRfUnfdgqpPqd
 HTkEzMGsQ2PMMbE8R9DF5GU8B9xAcnKMh2g3/9KGStbocGSFWahLRObkHEhC5uJu
 g5ncQio3o/AtlBirywn/lkd6CYRDvMheMVOTHtv4/ZN0hIONMXCb6u1SQfqnX7qb
 fRP2UP9VUpPI9MUfOn/0uqM8/zXb5SMRe78p9UIYCF+mEDST190VxsdMjiBp/Xug
 Pktlec72iyiNHCavp04nXkt2kBrfSIFFaAQ0Qlp4huRV1k3Ur672NHtwuPLv8ORH
 xLec8On6nWVuuu5kC0F+4KxTlu6u2CMwH+wVr7t/D4rrD1iVo39MtElTBawZZC6+
 8EapnNHyGg==
 =A+Dp
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.17'

release v0.21.17
2019-12-16 23:44:20 +01:00
Max Kellermann 15ce8eb487 time/ISO8601: support omitting field separators
Closes https://github.com/MusicPlayerDaemon/MPD/issues/685
2019-12-16 23:31:29 +01:00
Max Kellermann 63c5d66016 time/ISO8601: support omitting minutes 2019-12-16 23:24:43 +01:00
Max Kellermann d09bd9178f time/ISO8601: support omitting seconds 2019-12-16 23:24:43 +01:00
Max Kellermann 7d8b1860c3 time/ISO8601: support time zone offset 2019-12-16 23:24:43 +01:00
Max Kellermann b06825829b time/ISO8601: allow omitting the "Z" suffix
And allow "Z" suffix after date.
2019-12-16 23:24:43 +01:00
Max Kellermann ba4cd47fd8 time/ISO8601: allow omitting the time of day 2019-12-16 23:24:43 +01:00
Max Kellermann 5df2707d98 time/ISO8601: ParseISO8601() returns precision 2019-12-16 23:24:43 +01:00
Max Kellermann 4859ea468f time/ISO8601: implement with strptime(), without ParseTimePoint()
Prepare for adding more flexible parsing.
2019-12-16 23:24:43 +01:00
Max Kellermann 2a8830db70 time/Convert: fallback TimeGm() implementation
Move code from Parser.cxx.
2019-12-16 23:24:38 +01:00
Max Kellermann fed9b6fd74 time/Parser: use TimeGm() 2019-12-16 23:03:31 +01:00
Max Kellermann b02890eb8a time/Parser: explicitly initialize struct tm before strptime()
This is recommended by the strptime() manpage, because strptime() does
not initialize/set attributes which were not specified in the format
string.
2019-12-16 23:03:25 +01:00
Max Kellermann da882a6eb6 time/Convert: include sys/time.h for struct timeval
Closes https://github.com/MusicPlayerDaemon/MPD/issues/562
2019-12-16 23:03:21 +01:00