My Next Excuse for Riding Trains

I won’t be blogging about riding trains until November when I’ll be traveling to Wrocław, Poland to attend a meeting of the ISO C++ standards committee, but I’m starting to think about it, and I’ve worked up a possible itinerary that includes a three-day conference in Berlin the week before and a one-day conference in Wrocław afterwards.

As I’ve said before, I like to fly Icelandair across the Pond because I like to get off the plane and stretch my legs in Keflavík.  Also, because travel to these meetings is the only thing I spend my fun money on, I’m fortunate to be able to afford Icelandair’s Saga class if I don’t try to afford other stuff that I don’t really want that much anyway.  (Business class on other airlines would probably be out of my price range; and besides, I wouldn’t want to sit in an airplane long enough to get all the way to Europe in one fell swoop.)

Unfortunately, Icelandair serves Berlin only five days per week, so the eastbound trip doesn’t work well.  I’m currently thinking about going a day late and missing almost all of the first day of Meeting C++.  I could fly into Frankfurt instead and take an ICE directly from the airport to Berlin; but then I’d have to return from Frankfurt to get the round-trip air fare; and getting from Wrocław to Frankfurt by train doesn’t look easy.

Nokia will be sponsoring a one-day conference called code:dive that’s still not officially announced, so I don’t know when or where it’ll be.  My rough itinerary assumes that it’ll be in the same hotel the Monday after the ISO meeting, which could be wrong; so the westbound trip is still subject to change.

Update, 2024-04-17:  I’ve added another option for the first leg that saves a long layover in Chicago.  That train originates in Kansas City and is often delayed on the former MoPac west of St. Louis, so I’m a bit leery about counting on it:  missing the very first connection would likely destroy the whole trip.

I checked out train 318’s arrival times in Chicago and the likelyhood of making my connection back to the 1st of October, and it doesn’t look too dangerous; but I’m still not sure I’d want to chance it.  (If I look only at Mondays, which is the weekday I’ll be traveling, I never miss the connection on any of the 29 days; but it’s not clear whether the weekday actually has any effect.)  I probably won’t be making any reservations until the end of July or so, so I’ll check again then.  I’ll probably just stick with the Texas Eagle in any event since that will allow checking a bag all the way to New York.  (The Missouri-Illinois corridor trains don’t have checked baggage service.)

I’ve also been told that Nokia’s code:dive conference will definitely be on Monday, November 25th.

Time Zones in C++

I think I have my timezone class ready for prime time, so I should be just about ready to finish the larger civil time library (which I put on hold because a couple of the classes depend on timezone).

But as I write this, I remember that there’s one thing I haven’t tested yet:  the option of reading TZ and TZ_ROOT environment variables using std::getenv() before the timezone class gets used for anything.  I do that magically with some tricky code that has the odor of the poltergeist anti-pattern; so I need to create the TZ and TZ_ROOT environment variables on my Windows box and make sure that that works.  I don’t see any reason why it won’t, so I’ll say tentatively that I’m done.

Questions for Mac Users

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 /usr/share/zoneinfo”; and TZ could be localtime or, in the U.S. central time zone for example, either America/Chicago or CST6CDT,M3.2.0,M11.1.0”.

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 /etc/timezone.

My Debian Linux box, a VPS actually, is somewhere in England; so /etc/localtime is a symlink to /usr/share/zoneinfo/Europe/London and /etc/timezone is a plain text file that contains just Europe/London”.

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.

On the Cancer Front

As I’ve said before, I’m participating in a study of the effectiveness of prophylactic radiation treatments to keep small cell cancer out of the brain.  That’s currently the standard care, but it’s based on a study from back in the ’70s (IIRC) and n was small.

This study is random but not blind, so I know that I was randomized into the control group.  I’ll be getting everything except the actual radiation.

On Monday, I had some blood drawn and the nurse who runs the study at my particular hospital gave me the test of cognitive abilities that, I guess, is the one that Trump misremembered; yesterday, I had a CT scan and an MRI; and today I had follow-up appointments with the chemo and radiation oncologists.  IIRC, the current plan is to do that every three months for a year, then every six months for the second and last year.

The blood work and the MRI turned out fine (I wasn’t told whether I’m thinking straight πŸ˜Ž ), but the CT scan showed what could possibly me more cancer, this time in a lymph node.  I’ll be getting a PET scan on Monday, and then I’ll meet with the chemo doctor, and maybe the radiologist as well, on the 27th.  They might also want me to get a biopsy.  We’ll see how it goes.  I was told that, in any event, I’ll still be in the study and so still be doing my small bit to add to human knowledge.

One thing that occurs to me:  if Trump wins in November, this might be a good time to check out. πŸ˜Ž

Time Zones

I’ve been debugging my timezone stuff somewhat casually, but I think I have it to the point where I’m willing to admit that I wrote it. πŸ˜Ž

This paper also references a trivial library that I’ve mentioned before.

If anybody who cares can think of any cool features that I should add, please let me know, either in the comments or in a private e-mail message.

I can now finish my larger civil time library which contains classes that are intended to be the C++ equivalents of SQL’s datetime types, which in turn will be part of a database access library.  (I’m still having fun in my retirement.)

Some Fun Time Zone Geekiness

There were a few e-mail messages on the FtB backchannel a little while ago.  An FtB blogger who lives in Ireland was wondering when the next FtB Podish-Sortacast will happen (https://freethoughtblogs.com/pharyngula/2024/03/09/in-my-prime/, scroll down a bit), probably just under an hour from when I get this posted.

That got me to thinking about civil time in the Irish Republic.  It winds up that they observe the same time as Great Britain and Northern Ireland, except they get there with rather tortured reasoning.

In the U.K., they switch from “Greenwich Mean Time” (GMT, same as UTC+0) to “British Summer Time” (BST, UTC+1) on the last Sunday in March at 01:00:00 local wall clock time, and they switch back from BST to GMT on the last Sunday in November at 02:00:00 local wall clock time.

In Ireland, they switch from ”Irish Standard Time” (IST, UTC+1) to GMT on the last Sunday in November at 02:00, and they switch back from GMT to IST on the last Sunday in March at 01:00.

Yes, really. Go figure. πŸ˜Ž

The POSIX TZ environment variable for Europe/London:  GMT0BST,M3.5.0/1,M10.5.0
The POSIX TZ environment variable for Europe/Dublin:  IST-1GMT0,M10.5.0,M3.5.0/1

Why did they bother?

A Couple of C++ Quickies

I wrote two fairly trivial libraries to support my development of the timezone class that I’ve mentioned before.

1.  Reading Directories in C++ describes a class that loops through directories.  It’s portable to both POSIX and Windows so that you don’t have to do that in two very different ways.

2.  Getting Zoneinfo Data on Windows describes a simple way to do what the title says along with a couple of functions that let you create and delete symbolic links on Windows.

Both of those are really old news, and neither has any great ideas of my own, so all that code is in the public domain.

The timezone class is finished, but I still need to do some testing before I release the code to the world and, perhaps, embarrass myself. πŸ˜Ž  I hope to have that done later today.

Reading Directories in C++

This one is trivial.

For testing my timezone code, I often need to recurse through all the directories where the Zoneinfo binary files are.  I got tired of rewriting the programs depending on whether I was testing on Linux or Windows, so I decided to write a little framework that would be portable to both operating systems.  It doesn’t solve all the problems (the two systems provide different information about directory entries), but at least I don’t have to completely restructure the main loops. πŸ˜Ž

There are no new ideas here:  how to loop through directories is really old news; and since it’s not particularly original on my part, all the code is in the public domain.

Time Zones in C++

I’m back to working on a database access library in C++ and, at present, I’m developing a library of civil time classes that would mimic SQL’s datetime types.  In the next two or three days, I hope to have a timezone class ready for prime time; and I’ve decided to document it separately from the rest of the civil time library because there’s no reason why it couldn’t be a stand-alone class in its own right.

I don’t have the final code ready to share yet, but I wanted to make the design available while the class is still under development in case there’s anybody out there who would like to suggest any additional features that I haven’t thought of.

Is there anything else you think I need?

Update:  I just found out that Windows’ filesystem does indeed support symbolic links.  (I’m not sure what planet I’ve been living on.)  I’ve also figured out an easy way to create a .zip archive with the symlinks in it* and unzip that on my Windows box.  I guess I have a bit of a redesign to work on. πŸ˜Ž

*I can also create a .tar.gz that’s about one fifth the size of the .zip file, but I don’t see how to get the links as links (rather than copies of the file), and the .zip file is only about 2.5Mb.