52 #ifndef __PCL_TimePoint_h
53 #define __PCL_TimePoint_h
118 , m_jdf(
Frac( jd ) )
135 , m_jdf(
Frac( jd1 ) +
Frac( jd2 ) )
152 TimePoint(
int year,
int month,
int day,
double dayFraction )
160 TimePoint(
int year,
int month,
int day,
int hour,
int minute,
double seconds )
162 CalendarTimeToJD( m_jdi, m_jdf, year, month, day, (hour + (minute + seconds/60)/60)/24 );
176 int year, month, day;
193 int year, month, day;
233 return ((m_jdi > 0) ? m_jdi : -m_jdi) < 2147438065;
297 void GetCalendarTime(
int& year,
int& month,
int& day,
int& hour,
int& minute,
double& seconds )
const
301 double h =
Frac( dayf )*24;
302 double m =
Frac( h )*60;
303 seconds =
Frac( m )*60;
313 int year, foo;
double bar;
323 int foo, month;
double bar;
333 int foo, day;
double bar;
343 int foobar;
double dayf;
364 return ToString( options, tz, (
String*)0 );
393 String ToString(
unsigned timeItems,
unsigned precision = 3,
double tz = 0,
bool timeZone =
true,
bool zuluTime =
true )
const
414 return ToString( options, tz, (
IsoString*)0 );
443 IsoString ToIsoString(
unsigned timeItems,
unsigned precision = 3,
double tz = 0,
bool timeZone =
true,
bool zuluTime =
true )
const
532 IsoString ToIsoString(
const char* format )
const
534 return ToIsoString(
IsoString( format ) );
550 return ToIsoString();
566 constexpr
double JDF()
const
583 constexpr
double JD()
const
585 return m_jdi + m_jdf;
594 constexpr
double MJD()
const
596 return (m_jdi-2400000) + (m_jdf-0.5);
648 EnableDeltaTExtrapolation( !disable );
698 return m_jdi-t.m_jdi + m_jdf-t.m_jdf;
707 return DaysSince( t )/365.25;
716 return DaysSince( t )/36525;
725 return DaysSince( t )*86400;
734 return DaysSinceJ2000();
744 return YearsSinceJ2000();
754 return CenturiesSinceJ2000();
763 return SecondsSinceJ2000();
772 return m_jdi-2451545 + m_jdf;
781 return DaysSinceJ2000()/365.25;
790 return DaysSinceJ2000()/36525;
799 return DaysSinceJ2000()*86400;
808 return m_jdi-2440587 + m_jdf-0.5;
817 return DaysSinceUNIXEpoch()/365.25;
826 return DaysSinceUNIXEpoch()/36525;
835 return DaysSinceUNIXEpoch()*86400;
844 return DaysSinceUNIXEpoch()*86400000;
861 return TimePoint( m_jdi, m_jdf + SystemOffsetFromUTC()/24 );
870 return TimePoint( m_jdi, m_jdf - SystemOffsetFromUTC()/24 );
921 t.m_jdf = 0.42345905;
954 int year, month, day;
957 return TimePoint( year, month, day, dayf - tz/24 );
977 int year, month, day;
980 return TimePoint( year, month, day, dayf - tz/24 );
1037 int year, month, day;
1041 t =
TimePoint( year, month, day, dayf - tz/24 );
1067 int year, month, day;
1071 t =
TimePoint( year, month, day, dayf - tz/24 );
1097 return TryFromString( t, tz, dateTime );
1120 return TryFromString( t, tz, dateTime );
1137 m_jdf =
Frac( m_jdf );
1147 else if ( m_jdi < 0 )
1155 S ToString(
const ISO8601ConversionOptions& options,
double tz, S* )
const
1159 int year, month, day;
1162 return S::ToISO8601DateTime( year, month, day, dayf, tz, options );
1173 struct PCL_AssertTimePointSize
1176 static_assert(
sizeof( TimePoint ) ==
sizeof( TestData ),
"Invalid sizeof( TimePoint )" );
1196 return t1.
JD() == jd2;
1207 return t2.
JD() == jd1;
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
void ParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const
bool TryParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const noexcept
void ParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const
bool TryParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const noexcept
An instant in any timescale.
static bool TryFromString(TimePoint &t, const IsoString &dateTime)
constexpr double YearsSinceUNIXEpoch() const
static bool TryFromString(TimePoint &t, double &tz, const String &dateTime)
constexpr double SecondsSince(const TimePoint &t) const
constexpr double CenturiesSinceReferenceEpoch() const
constexpr double DaysSinceUNIXEpoch() const
constexpr double CenturiesSinceJ2000() const
double DayFraction() const
TimePoint UTCToLocalTime() const
static TimePoint FromString(const String &dateTime)
static void EnableDeltaTExtrapolation(bool enable=true)
TimePoint LocalTimeToUTC() const
TimePoint(double jd1, double jd2)
static bool TryFromString(TimePoint &t, const String &dateTime)
constexpr double JD() const
constexpr double YearsSinceJ2000() const
constexpr double DaysSinceJ2000() const
constexpr double DaysSince(const TimePoint &t) const
void GetCalendarTime(int &year, int &month, int &day, int &hour, int &minute, double &seconds) const
TimePoint(const String &dateTime)
constexpr double YearsSince(const TimePoint &t) const
constexpr double SecondsSinceUNIXEpoch() const
constexpr double MJD() const
IsoString ToIsoString(const IsoString &format) const
constexpr double YearsSinceReferenceEpoch() const
String ToString(const ISO8601ConversionOptions &options=ISO8601ConversionOptions(), double tz=0) const
void GetCalendarTime(int &year, int &month, int &day) const
constexpr int JDI() const
IsoString ToIsoString(unsigned timeItems, unsigned precision=3, double tz=0, bool timeZone=true, bool zuluTime=true) const
static TimePoint UNIXEpoch()
IsoString ToIsoString(const ISO8601ConversionOptions &options=ISO8601ConversionOptions(), double tz=0) const
static TimePoint FromString(const IsoString &dateTime)
constexpr double SecondsSinceReferenceEpoch() const
TimePoint(int year, int month, int day, double dayFraction)
String ToString(unsigned timeItems, unsigned precision=3, double tz=0, bool timeZone=true, bool zuluTime=true) const
TimePoint(const TimePoint &)=default
constexpr double SecondsSinceJ2000() const
TimePoint(const FileTime &fileTime)
constexpr double JDF() const
TimePoint(const IsoString &dateTime)
static void DisableDeltaTExtrapolation(bool disable=true)
double SystemOffsetFromUTC() const
TimePoint(int year, int month, double days)
TimePoint(int year, int month, int day, int hour, int minute, double seconds)
constexpr bool IsValid() const
static TimePoint ReferenceEpoch()
constexpr double CenturiesSinceUNIXEpoch() const
constexpr double CenturiesSince(const TimePoint &t) const
static bool IsDeltaTExtrapolationEnabled()
static TimePoint FromString(double &tz, const IsoString &dateTime)
constexpr double MillisecondsSinceUNIXEpoch() const
constexpr double DaysSinceReferenceEpoch() const
static bool TryFromString(TimePoint &t, double &tz, const IsoString &dateTime)
static TimePoint FromString(double &tz, const String &dateTime)
void GetCalendarTime(int &year, int &month, int &day, double &dayf) const
String ToString(const String &format) const
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
void PCL_FUNC CalendarTimeToJD(int &jdi, double &jdf, int year, int month, int day, double dayf=0) noexcept
constexpr T Frac(T x) noexcept
void PCL_FUNC JDToCalendarTime(int &year, int &month, int &day, double &dayf, int jdi, double jdf) noexcept
int TruncInt(T x) noexcept
unsigned long long uint64
Formatting options for string representations of dates and times in ISO 8601 format.