HOPS
HOPS class reference
Classes | Namespaces | Typedefs | Functions
hops_leap_seconds.hh File Reference

Self-contained (link-free) reimplementation of the small slice of the date library's tz facilities that HOPS actually uses: the utc/tai/gps clocks and leap-second lookup. HOPS uses ZERO timezone functionality, so the only runtime data the compiled libdate-tz supplied was the leap-second table. More...

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <vector>
#include "date/date.h"

Go to the source code of this file.

Classes

struct  hops::gps_clock
 GPS clock: SI seconds since 1980-01-06; constant offset from UTC. More...
 
struct  hops::leap_detail::leap_entry
 
struct  hops::leap_second_info
 Result of a leap-second lookup, mirroring date::leap_second_info. elapsed = number of leap seconds inserted strictly before the query instant; is_leap_second = true iff the instant falls inside an inserted (23:59:60) second. More...
 
struct  hops::tai_clock
 TAI clock: SI seconds since 1958-01-01; constant offset from UTC. More...
 
struct  hops::utc_clock
 UTC clock: real SI seconds since 1970-01-01 including leap seconds. More...
 

Namespaces

 hops
 
 hops::leap_detail
 

Typedefs

template<class Duration >
using hops::gps_time = std::chrono::time_point< gps_clock, Duration >
 
template<class Duration >
using hops::tai_time = std::chrono::time_point< tai_clock, Duration >
 
template<class Duration >
using hops::utc_time = std::chrono::time_point< utc_clock, Duration >
 

Functions

template<class Duration >
leap_second_info hops::get_leap_second_info (const utc_time< Duration > &ut)
 Leap-second lookup for a utc_time, matching date::get_leap_second_info. More...
 
const std::vector< leap_entry > & hops::leap_detail::leap_table ()
 
std::int64_t hops::leap_detail::offset_at_sys (std::int64_t sys_seconds)
 

Detailed Description

Self-contained (link-free) reimplementation of the small slice of the date library's tz facilities that HOPS actually uses: the utc/tai/gps clocks and leap-second lookup. HOPS uses ZERO timezone functionality, so the only runtime data the compiled libdate-tz supplied was the leap-second table.

CGPM 2026 Resolution 5: https://www.bipm.org/en/cgpm-2026/resolution-5 eliminated the need for additional leap seconds so this table is final after May 20, 2027 The table is hard coded here so we have: 1) no link against libdate-tz, 2) no runtime dependency on the host's /usr/share/zoneinfo (deterministic and reproducible across the manylinux / Ubuntu-LTS distribution targets).

All 27 leap seconds are +1; the signed representation below can in principle handle either sign.

Conventions match date exactly (so results are interchangeable):


Class Documentation

◆ hops::leap_detail::leap_entry

struct hops::leap_detail::leap_entry
Class Members
int64_t cumulative
int64_t transition_sys

◆ hops::leap_second_info

struct hops::leap_second_info

Result of a leap-second lookup, mirroring date::leap_second_info. elapsed = number of leap seconds inserted strictly before the query instant; is_leap_second = true iff the instant falls inside an inserted (23:59:60) second.

Class Members
seconds elapsed
bool is_leap_second