[Jaffa Software]

Sunday 26 February 2012

Avoiding jet lag using continuous clock change

These days I'm often travelling long distances; whether it's to Asia or Detroit with work; or San Francisco for the MeeGo and JavaOne Conferences.

Ten hour flights are rarely fun; but when combined with a ten hour time difference? The jet lag can destroy you.

However, I trust a clock when I see it. So if I can convince myself that the time isn't changing in one big jump, jet lag is less of an issue. I used to do this with my watch: every two hours on a ten hour flight with an eight hour time difference: move my watch forward two hours. By speeding up, or slowing down time, I find it excellent for transitioning gradually to my destination timezone.

My N9's standby screen provides an opportunity to do this automatically: every time I glance at my phone on the flight, it could show me the right "transient" time.

I prototyped it with a spreadsheet (download), for a recent trip to Korea, to see how effective it would be before writing an app:


To try it out, first off, enter the local departure and arrival times; and the timezone difference:

If travelling eastwards, the time difference will be positive. If travelling westwards, it will be negative.

A shell script will then be shown in column E. Copy this column and paste it into a text editor. Copy the resulting script to your UNIX-based mobile device (N9, N950, N900, N8x0, jailbroken iPad).

On a Harmattan device, the script needs to be run in develsh:

~ $ develsh outbound.sh

On everything else it needs to be run as root:

Jaffas-iPad:~ mobile$ su -
Jaffas-Ipad:~ root# sh outbound.sh

If run with screen or nohup, you shouldn't even need to keep the terminal open.


Obviously the next step is an app. Is it something you'd be interested in? Is there a nice Qt API for changing the time? Are there Qt APIs for looking up timezones, and setting the device's timezone?

Thanks to eipi for allowing me to use MaeFlight's icon in this post. Also published on Nokia Developer blogs


  1. One idea would be to start a local, fake NTP server and make something like ntpdate or ntpd take care of updating the time.

    Also have a look at ntpd, maybe it already has features like this (basically interpolating between an old and a new time).

    You can of course also calculate the time deltas using a scripting language of your choice (Python and its "datetime" modules comes to my mind, but you probably prefer Perl) - or even a crude shell.

  2. you mentioned that you used to manually move your watch forward but, i am curious -- does your cell phone not automatically update the time that it displays as you travel to new cities?

  3. N9 and N900 changed automatically, but my BlackBerry doesn't.

    In flight, it's the gradual change which makes the technique work. Auto-changing of phones is based on information broadcast from the cell towers, so doesn't work whilst in flight-mode.

  4. Thank you for great post. It is very good tips, although I guess that flying always be very exhausting due change pressure and dry air. I guess human are not made to be traveling at 10 km altitude close to speed of sound, so we are always going to pay some price, I mean little price. Anyway I am enjoying the traveling and flying so I am willing to suffer a little after flight.