Ssh – How to correct wrong time zone offset via zic timezone compiler

iossshtimezone

I have an iPod touch (2nd gen) running iOS 3.1.3 (since it won't perform well with iOS 4) and constant troubles with the clock setting itself one hour ahead of the actual time when I connect it to the computer.

When I SSH into the device:

  • date "+%Z" returns ARST which is correct (I'm in Buenos Aires, Argentina)
  • date "+%z" the result is -0200, which is wrong and should be -0300

My question is: How do I correct the offset of my timezone to the real value?

I have found mentions of zic, zdump and references to a "IANA Time Zone Database".
I've tried to find already compiled files in order to replace the whole "zoneinfo" folder, but the downloads I could find seem to use a different folder structure than the one on the iPod.

Edit: I am looking for a way to edit or update the timezone information, so that my timezone "ARST" is configured correctly. I have found several references to a compiler named zic.
Both zic and zdump are present on the device, which leads me to believe it can be done via SSH and UNIX commands.

Best Answer

I found the solution here.

However, the tzdata source has changed its URI. It is now to be found at: ftp://ftp.iana.org/tz/ or http://www.iana.org/time-zones for more information.

  1. Download the updated tzdata-file, in this case, tzdata2012j.tar.gz and extracted it to a temporary folder.

  2. SSH into the iPod and copy the extracted files to the iPod. I chose User/Downloads and created a new (temporary) folder tzfix into which I copied everything.

  3. After that, compile it with the command: zic southamerica, which takes a few seconds.

  4. Then, use the following command to copy this file:

    cp /usr/share/zoneinfo/America/Argentina/Buenos_Aires /usr/share/zoneinfo/America/Buenos_Aires

  5. Testing date "+%z" and date "+%Z" both return correct values, now: -0300 and ART

Finally! I can set the clock to the correct time without Twitter refusing to login and Google Authenticator throwing wrong auth codes.

Edit: There is another separate database for the time which needs to be updated: the ICU database. It uses the same tzdata and needs to be compiled into /usr/share/icu/icudt40l.dat. This is necessary so that the clock and calendar apps show the correct time.

Related Question