Time on your Brightbox

By default, Brightboxes are configured to use Coordinated Universal Time (UTC). In the context of this document, UTC is the same time as Greenwich Mean Time (GMT) i.e. 1300 GMT is 1300 UTC.

Why is UTC good?

UTC is independent of timezones, it is generally thought to be good practice to use UTC on servers. Timezones can be problematic for servers, for example a cronjob may not run when the clocks are changed with a seasonal time change, such as Daylight Saving Time.

UTC also helps to make data transferable. So, if your data is stored in a database with UTC timings, it is easy for an application to translate this into local timezones. E.g CET = UTC+1, PST = UTC-8

When can UTC be bad?

If your web application is geographically specific, UTC may cause a problem for you. For example, you have a web application that tells a user when their favourite TV show is on. Your countdown time would be wrong as Ruby will be using UTC, not the visitors timezone.

The best of both worlds

Since Rails 2.1 you can now set the timezone via Rails, and still leave the server timezone as UTC.

WARNING You MUST make sure all your database times are UTC. If not, this will mess up your times. If you have not changed your server timezone at all, you will be OK.

Within your 2.1+ Rails application you can see which timezones are available to you.

rake time:zones:all 

Then, in environment.rb add the following

config.time_zone = "Your desired time zone"

This leaves all timings in your database as UTC. Ruby will translate these UTC timings to your selected timezone when required. The best of both worlds.

Changing the timezone

Though we generally recommend leaving the timezone on your Brightboxes set to UTC, you can change timezone at any time like so.

sudo dpkg-reconfigure tzdata

You'll be presented with a nice menu, allowing you to choose whichever timezone you wish.

docs/time_on_your_brightbox.txt · Last modified: 2011/05/27 19:26 by ben