I’ve been slow to finish testing my C++ time zone code because I’ve had other things to do; but I think I have it ready for prime time.
But now, in the spirit of the analysis paralysis anti-pattern 😎 (I’m having fun in my retirement, don’tcha know), I’ve decided that I’d like to make it magically portable to the Mac if I can.
1. Does the Mac have the Zoneinfo data somewhere?
2. Do you have POSIX-style environment variables (possibly called TZ_ROOT and TZ) for
a. the directory where the Zoneinfo compiled binaries are found, and/or
a. your local time zone?
If Macs are at all Linux-like except for having the environment variables, TZ_ROOT could be
And for those doing C++ work with some version of GCC,
3. is there some macro or other predefined identifier that says we’re compiling for a Mac rather than some other POSIX-like O/S?
I could probably go to an Apple store, fire up a Korn (or other) shell, and find out what I need for myself; but I’m hoping that there’s somebody reading this blog who already knows the answers off the top of their head.
Thanks.
Update: thanks to robert79 for some good information about Macs.
It looks like they work pretty much like Linux, except that the filesystem has no symbolic link called localtime, so I still have no clue how a program can discover what the local time zone is. There’s certainly some way to set the time zone through the UI, but I still need to find out how to discover that setting programmatically. Maybe Google will help.
Update2: well, that was easy. I should have just Googled from the get-go.
It seems that, in POSIX systems generally, /etc/localtime is usually a symbolic link to the real file. There should also be a file called
My Debian Linux box, a VPS actually, is somewhere in England; so /etc/localtime is a symlink to
I don’t need any code changes, just some remarks in the documentation that the library will work on a Mac; and I still have to proofread that anyway.
Thanks again to robert79.
