Commit graph

16 commits

Author SHA1 Message Date
Lenny Maiorani
4c5e9f5633 Everywhere: Deduplicate day/month name constants
Day and month name constants are defined in numerous places. This
pulls them together into a single place and eliminates the
duplication. It also ensures they are `constexpr`.
2022-03-18 23:48:50 +00:00
Timothy Flynn
0dfb9714fe LibCore: Use altzone for the current time zone offset during DST
Also use the daylight global to determine the current time zone name,
i.e. tzname[0] is standard time, tzname[1] is daylight savings time.

Note that altzone isn't required to be defined on all systems, so we
have to #ifdef to check if it exists in order for Lagom to build.
2022-03-13 17:50:49 +01:00
Isak Holmstrom
41765895a8 LibCore: Make FreeBSD build SerenityOS 2022-02-17 09:26:56 +00:00
Timothy Flynn
b387ac56b6 LibCore: Change DateTime format strings to be StringViews
There's no need to allocate a String for these. Note the "string"
parameter of DateTime::parse is left as a String for now; the parser is
currently using strtol which needs a NUL-terminated string. This method
can likely be rewritten with GenericLexer.
2022-01-28 20:19:05 +00:00
Timothy Flynn
29c8ec5eb6 LibCore: Support (and use) DateTime string formatting of the form %Z
This formats the time zone name. This is now used in the default format
string because DateTime is meant to represent local time; it only makes
sense to include the time zone by default now that we support non-UTC.
2022-01-25 23:21:30 +00:00
Timothy Flynn
9605be19bb LibCore: Support DateTime string formatting of the form %:z
This formats the time zone offset as "+hh:mm" or "-hh:mm". This doesn't
appear to be strictly POSIX, but it is how Linux implements this format.
2022-01-25 23:21:30 +00:00
Timothy Flynn
d9ee218701 LibCore: Support DateTime string formatting of the form %z
This formats the time zone offset as "+hhmm" or "-hhmm".
2022-01-25 23:21:30 +00:00
Idan Horowitz
95bc8e4641 LibCore: Make DateTime's members signed
Core::DateTime is essentially a C++ wrapper of the tm struct, so we
should support the same signed range as the underlying tm.
2021-08-19 19:15:00 +01:00
Brian Gianforcaro
176e1cbca7 LibCore: Remove unused header includes 2021-08-01 08:10:16 +02:00
x-yl
904322e754 LibCore: Add a way to parse a DateTime from a string
DateTime can now be parsed from a string. Implements the same formatters
as strptime: https://linux.die.net/man/3/strptime (Well, some of them at
least).
2021-06-11 23:58:28 +04:30
Andreas Kling
24c149b013 LibCore: Convert StringBuilder::appendf() => AK::Format 2021-05-07 21:12:08 +02:00
Linus Groh
dbe72fd962 Everywhere: Remove empty line after function body opening curly brace 2021-04-25 20:20:00 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
AnotherTest
db8f0a2fa6 LibCore: Remove the no-longer-used Core::DateTime::is_before() function 2021-04-18 14:18:16 +02:00
Andreas Kling
ef1e5db1d0 Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
Good-bye LogStream. Long live AK::Format!
2021-03-12 17:29:37 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Renamed from Libraries/LibCore/DateTime.cpp (Browse further)