Ticket #666 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Simplify DateTime API

Reported by: fpierfed Owned by: ktl
Priority: normal Milestone:
Component: daf_base Keywords:
Cc: Blocked By:
Blocking: Project: LSST
Version Number:
How to repeat:

not applicable

Description

The DateTime? class API is a little bit confusing to me. It seems to imply that MJD and TAI are mutually exclusive whereas they are not (MJDs can be expressed in e.g. UTC or TAI or localtime). I would really like a simpler API of the form

t = DateTime(mjd, timescale=UTC)
t = DateTime(jd) # assume timescale=TAI
t = DateTime(year, month, day, hours, minutes, seconds) # assume timescale=TAI
t.mjd() # return t as MJD in TAI
t.mjd(timescale=UTC) # return MJD in UTC
t.nsec() # return t as ns from midnight Jan 1 1970 in TAI

etc.

Change History

comment:1 Changed 10 years ago by fpierfed

nice ticket number :-)

comment:2 Changed 10 years ago by ktl

  • Status changed from new to assigned

comment:3 Changed 10 years ago by ktl

In addition, the sign of the TAI to UTC conversion (and vice versa) seems to be backwards.

And the leap second formula needs to be extended backward in time to at least 1962-07-10.

comment:4 Changed 10 years ago by ktl

  • Status changed from assigned to needinfo
  • Owner changed from ktl to fpierfed

New interface (and test cases) has been committed as [7646]. Please check this out before I merge it to the trunk.

comment:5 Changed 10 years ago by fpierfed

  • Status changed from needinfo to assigned
  • Owner changed from fpierfed to ktl

Works great! Thank you KT!

comment:6 Changed 10 years ago by ktl

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged to trunk in [7691].

Note: See TracTickets for help on using tickets.