LIGOTimeGPS

class ligotimegps.LIGOTimeGPS(seconds, nanoseconds=0)

Bases: object

An object for storing times with nanosecond resolution

Internally the time is represented as a signed integer gpsSeconds part and an unsigned integer gpsNanoseconds part. The actual time is always constructed by adding the nanoseconds to the seconds. So -0.5 s is represented by setting seconds = -1, and nanoseconds to 500000000.

Parameters:
  • seconds (int, str) – the count of seconds
  • nanoseconds (int, str, optional) – the count of nanoseconds

Examples

>>> LIGOTimeGPS(100.5)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS("100.5")
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS(100, 500000000)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS(0, 100500000000)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS(100.2, 300000000)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS("0.000000001")
LIGOTimeGPS(0, 1)
>>> LIGOTimeGPS("0.0000000012")
LIGOTimeGPS(0, 1)
>>> LIGOTimeGPS("0.0000000018")
LIGOTimeGPS(0, 2)
>>> LIGOTimeGPS("-0.8")
LIGOTimeGPS(-1, 200000000)
>>> LIGOTimeGPS("-1.2")
LIGOTimeGPS(-2, 800000000)

Attributes Summary

gpsNanoSeconds residual nanoseconds
gpsSeconds Seconds since 0h UTC 6 Jan 1980
nanoseconds residual nanoseconds
seconds Seconds since 0h UTC 6 Jan 1980

Methods Summary

ns() Convert a LIGOTimeGPS to a count of nanoseconds as an int

Attributes Documentation

gpsNanoSeconds

residual nanoseconds

gpsSeconds

Seconds since 0h UTC 6 Jan 1980

nanoseconds

residual nanoseconds

seconds

Seconds since 0h UTC 6 Jan 1980

Methods Documentation

ns()

Convert a LIGOTimeGPS to a count of nanoseconds as an int

When running python2.7 on Windows this is returned as numpy.long to guarantee long-ness.

Examples

>>> LIGOTimeGPS(100.5).ns()
100500000000