{"id":23118,"library":"ligotimegps","title":"LIGOTimeGPS","description":"A pure Python implementation of LIGOTimeGPS, used for converting between LIGO time (GPS seconds) and standard time formats. Current version is 2.1.0, requiring Python >=3.11. Released irregularly with minor version bumps.","status":"active","version":"2.1.0","language":"python","source_language":"en","source_url":"https://git.ligo.org/cds/software/ligotimegps","tags":["ligo","gps-time","time-conversion"],"install":[{"cmd":"pip install ligotimegps","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Many users mistakenly import from the internal submodule path; the top-level import is the correct public API.","wrong":"from ligotimegps.ligotimegps import LIGOTimeGPS","symbol":"LIGOTimeGPS","correct":"from ligotimegps import LIGOTimeGPS"}],"quickstart":{"code":"from ligotimegps import LIGOTimeGPS\n\nt = LIGOTimeGPS(1234567890, 0)\nprint(t)\nprint(float(t))\nprint(t.gpsSeconds, t.gpsNanoSeconds)","lang":"python","description":"Create a LIGOTimeGPS object from GPS seconds and nanoseconds, then print its string representation, float value, and components."},"warnings":[{"fix":"Ensure nanoseconds are normalized (0 <= ns < 1e9) before passing to the constructor, or use the from_float method.","message":"The constructor accepts two integers (seconds, nanoseconds), but nanoseconds can be negative. This can cause confusion when converting from other time representations.","severity":"gotcha","affected_versions":"all"},{"fix":"Use explicit conversion to float for comparisons and arithmetic.","message":"Arithmetic operations like +, -, <, > are supported, but there is no official documentation for edge cases (e.g., overflow). Relying on undocumented behavior may break in future versions.","severity":"deprecated","affected_versions":"all"},{"fix":"Always convert to float for comparisons: float(t) > 1e9.","message":"The ability to compare LIGOTimeGPS with integers/floats directly may be removed. In version 2.x, this works implicitly, but future versions might require explicit conversion.","severity":"breaking","affected_versions":"2.x"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip show ligotimegps' to verify installation. Import using 'from ligotimegps import LIGOTimeGPS'.","cause":"Multiple installs or importing from wrong path after an incomplete import.","error":"AttributeError: module 'ligotimegps' has no attribute 'LIGOTimeGPS'"},{"fix":"Convert to int or float: int(t.gpsSeconds) or float(t).","cause":"Trying to use LIGOTimeGPS directly in functions expecting an integer, like range() or indexing.","error":"TypeError: 'LIGOTimeGPS' object cannot be interpreted as an integer"},{"fix":"Use LIGOTimeGPS.from_float(1234567890.0) or parse the string yourself.","cause":"Passing a float string to LIGOTimeGPS. The constructor does not parse strings.","error":"ValueError: invalid format for LIGOTimeGPS: '1234567890.0'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}