[tz] tzcode for windows?

random832 at fastmail.us random832 at fastmail.us
Fri Mar 8 20:42:49 UTC 2013

On Fri, Mar 8, 2013, at 14:39, Paul Eggert wrote:
> If it can be mostly partitioned into a separate area, which
> normally doesn't affect the mainline version, there'd be
> some interest I suppose.  I hope it wouldn't require
> many intrusive changes to the existing source.

The only substantial source changes I had to make to make zic work were:
Include a version of getopt (need one that's public-domain - I just used
a BSD one I found online for testing - anyone know where a PD one can be
found?) or (less appealing) implement command-line parsing manually.
Implemented windows versions of link and symlink. (Separate file).
Ideally, a file-copying solution needs to be implemented, and it bails
out if the link function returns an error (i.e. file already exists).
And of course a windows-specific makefile.

I'm less confident about the library functions. Part of the problem is
that to make them useful they need to not only work but be able to
replace the MSVC library functions when building a program. It might be
worthwhile, in general, to have a _separate_ library for converting
times using tzdata zones, that doesn't attempt to replace the system
tzset/localtime/etc functions. I bet that fails your "intrusive changes
to the existing source" test, though.

The biggest problem I ran into with date is that it requires _some_ way
to set the system clock, so I need to implement a windows function to do
so, or figure out a way to block out all time-setting functionality at
build time - I've also had problems getting it to "see" MSVC's library
functions - some header that's not being included or something, haven't
had time to track it down yet.

Haven't looked at zdump yet, and it's less useful without the library
functions anyway.

I also implemented a C version of yearistype, and a tzfile inspector
tool - the latter is something I've always wondered about the absence of
from the main distribution... zdump's output has a more abstract
relationship to the contents of zone files, this is meant to replace
byte-by-byte inspection in a hex editor - its parsing code is also
mostly independent of the library's. Those are more or less independent
of the rest, I can send them later this weekend [still have some bugs in
the inspector]


More information about the tz mailing list