wiki:HetDescription/jrf/HetDescription/jrf/tu_hettime

Version 2 (modified by admin, 7 years ago) (diff)

--

hetTime.py

Some useful tools for dealing with time at the HET in all its different formats

Definitions

  • unix time -- the number of seconds since the epoch. The epoch

defined as 00:00:00 UTC, January 1, 1970. This number may be a floating point value.

  • index time -- The tracker definition of the time of day. Index time

is reset to 0.0 at 1800 UT hours or 12 noon CST (1300 CDT). There is no information contained here that might indicate which day this index time occurred on. This number may be a floating point value.

0000 hours UT == 00000 secs UT == 0600 hours index == 21600 seconds index

0600 hours UT == 21600 secs UT == 1200 hours index == 43200 seconds index

1200 hours UT == 43200 secs UT == 1800 hours index == 64800 seconds index

1800 hours UT == 64800 secs UT == 2400 hours index == 86400 seconds index (0000)

(0000) 2400 hours UT == 86400 secs UT == 0600 hours index == 21600 seconds index

  • ISO time -- an ISO-8601 string of the format YYYY-MM-DDThh:mm:ss.mmmmmm, where YYYY is

the four digit year, MM is the two digit month (starts at 01), DD is the two digit day (starts at 01), hh is the two digit hour, mm is the two digit minute, ss is the two digit second, and mmmmmm is the fractional part of the second.

  • datetime -- a python datetime.datetime() object. This is the intermediate

object through which the time conversion routines work. It is also a value which Python can work with. See the documentation for the datetime package within Python

  • Future Plans.

Convert to object hetTime(), subclass of datetime, which takes an index time, unix time, datetime object or ISO string at instantion. added functions hetTime.indexTime(), hetTime.unixTime(), hetTime.ISOtime() to return time in different format. ISOtime and unixTime contain year/mon/day information but index time does not. Use the current year/mon/day unless there is a specified year/mon/day at instantation.

hetTime(index|unix|iso, year=now.year, mon=year.mon, day=now.day)

  • Functions
    1. ISO_To_DT(isoStr)
    2. DT_To_ISO(dt)
    3. Index_To_DT(ind)
    4. DT_To_Index(dt)
    5. Unix_To_DT(utime)
    6. DT_To_Unix(dt)