Re: How do I convert an ISO 8601 datetime into a unix timestamp - at compile-time?

2020-08-30 Thread Andrej Mitrovic via Digitalmars-d-learn
On Friday, 28 August 2020 at 12:35:26 UTC, Steven Schveighoffer wrote: It's trying to look up the local timezone at compile time. You need to specify a time zone: static time = SysTime(DateTime.fromISOString("20220101T00"), UTC()).toUnixTime; -Steve Aw, thanks Steve!

Re: How do I convert an ISO 8601 datetime into a unix timestamp - at compile-time?

2020-08-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/27/20 9:54 PM, Andrej Mitrovic wrote: - import std.datetime; void main () {     static time = SysTime(DateTime.fromISOString("20220101T00")).toUnixTime; } - - /Library/D/dmd/src/phobos/std/concurrency.d(2574): Error: static variable lock cannot be read at compile time

Re: How do I convert an ISO 8601 datetime into a unix timestamp - at compile-time?

2020-08-27 Thread Andrej Mitrovic via Digitalmars-d-learn
On Friday, 28 August 2020 at 01:54:02 UTC, Andrej Mitrovic wrote: - import std.datetime; void main () { static time = SysTime(DateTime.fromISOString("20220101T00")).toUnixTime; } - I think I'm supposed to use MonoTime here, right?

How do I convert an ISO 8601 datetime into a unix timestamp - at compile-time?

2020-08-27 Thread Andrej Mitrovic via Digitalmars-d-learn
- import std.datetime; void main () { static time = SysTime(DateTime.fromISOString("20220101T00")).toUnixTime; } - - /Library/D/dmd/src/phobos/std/concurrency.d(2574): Error: static variable lock cannot be read at compile time