Time Zones
Posted: Mon 9 March, 2009 | Author: Lyle | Filed under: Geeky, Getting Organised, Own Business, Web Development, Work-related |1 Comment »This will come as absolutely no surprise to many of you, but this morning I had a blinding flash of “Jesus I’m a twat”.
I’ve recently been working on a site where the server is based in the US, and I’ve been trying to sort out a regular task (a cron job, for those who know what the hell I’m whittling on about) that would run at midnight every day.
You can see where this is going already, can’t you? Believe me, I couldn’t until this morning.
I’ve been checking in the morning to see whether the cron job (timed to run at midnight, remember) had run overnight, and each day it hadn’t run. I’ve checked the logs – nothing. I’ve checked the command syntax umpteen times, and checked how it’s running via crontab. All fine. But the bloody thing’s not running.
However, I got a message at 7.05 this morning telling me it had tried to run.
And right then it occurred why this problem has been happening, why the script hasn’t been running at midnight.
It’s because:
- I’m a fuckwit
- The server’s in the US. Midnight in the US is (in this case) seven hours behind midnight here.
So come 7am GMT, the server runs the script at Midnight (US Server time). And all’s well.
I’ve changed it now, so that it runs at 5pm (US Server time) which is (of course) Midnight GMT. It means things will still fuck up come BST, but I’ll change things a bit to rectify that when I get round to it.
In the meantime, well, let’s just leave it that I’m a fuckwit.
You know the USA went onto Daylight saving yesterday?
I thought that was going to be your fuckwittery, not the rather obvious one of simple timezones 🙂