Alert.png The wiki is deprecated and due to be decommissioned by the end of September 2022.
The content is being migrated to other supports, new updates will be ignored and lost.
If needed you can get in touch with EGI SDIS team using operations @ egi.eu.

APEL/TimeZones

From EGIWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Time Zones and APEL

APEL works in UTC, which is both simple and convenient (because we happen to be in the UK).

Epoch Times

Epoch times are also convenient, because they are all in UTC and you don't have to convert. This means that whenever we get a message, we can rely on the timezone being correct and the conversion being automatic. In many of the batch system log files, the dates are in epoch times, presumably for the same reason.

ISO 8601

The CAR uses ISO 8601 dates and time durations. This presents a little bit more difficulty.

ISO 8601 Dates

The ISO 8601 dates are quite permissive, so there are a lot of possibilities. I'm using python-dateutil to parse them, which should work fine.

There is one caveat - if there is no time zone information provided in the date, I'm assuming that the date and time are in UTC - there's not much else I can do.

ISO 8601 Durations

These aren't that widely used, so there aren't standard libraries to parse them.

We are accepting durations of the form: P1Y2M3W4DT5H6M7S

  • The P denotes 'period' and must be at the start of the string.
  • Y, M, W, D, H, M, S stand for year, month, week, day, hour, minute and second respectively.
  • T (for time) sits between date values and time values so that you can distinguish months from minutes. So P1M or P1MT is one month, but PT1M is one minute.
  • All durations are optional and you can use any combination you choose.
  • Our calculations of month and year are approximate, so if you want to be exact use days, hours, minutes and seconds, eg P235DT14H7M12S. This is the same as P20354832S.

We treat one year as 365 * 24 * 60 * 60 = 31536000 seconds. We treat one month as 31536000 / 12 = 2628000 seconds.