libCalendarTime

libCalendarTime

libCalendarTime is a library written in C to deal with time zone conversion troubles. This library is available also for C++ language altough you can use libboost-date-time which is surely better than this one.

This library relies on the glibc functions mktime, strftime, strptime and so on, so it helps you to format and parse dates (in other words, to convert seconds since the epoch in string and to convert a string into seconds since the era) using user supplied formats and timezones.

Since you can supply different time zones to different functions you can solve this tedious problem:

  • The machine is in time zone A.

  • I have some data to provide to user "user" and they are expressed in time zone B.

  • User "user" would like to receive the data expressed in time zone C.

I read the glibc documentation and it seems to me that changing the time zone in something different to the machine time zone or to GMT is really a pain. May be I am wrong but I did not find anything better than chainging the environment variable "TZ" before using its functions.

The library was developed resambling the java Date object and the Java DateFormat and CalendarTime objects.