[Issue 12507] SysTime.init.toString should not segfault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 2 22:08:43 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12507



--- Comment #2 from Jonathan M Davis <jmdavisProg at gmx.com> 2014-04-02 22:08:36 PDT ---
Actually, on further reflection, I think that it might be possible to make
SysTime.init equivalent to SysTime(0, UTC()) and have it have a valid timezone.
Around dconf last year, someone made it so that immutable classes could be
created at compile time and continue on to runtime - so if a struct's member is
an immutable class, it can be initialized at compile time. At the time, I tried
to make that work with SysTime but ran into two problems:

1. SysTime uses a Rebindable!(immutable TimeZone), and the Rebindable couldn't
be assigned at compile time (a limitation with unions during CTFE IIRC).

2. Because LocalTime needs to call tzset when it's initialized, even if the
issue with Rebindable was fixed, SysTime.init's timezone field couldn't be
initialized with LocalTime.

However, UTC doesn't have that problem. So, if the issue with Rebindable has
been fixed (IIRC, I opened a bug on it, but I'd have to track it down), then we
could make SysTime.init use UTC. That's not quite idea IMHO, since SysTime
normally defaults to using LocalTime as its timezone, but it _would_ allow us
to  make it so that SysTime.init had a valid timezone without adding runtime
checks, and since SysTime.init is currently invalid anyway, it wouldn't break
any code.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list