hydrobricks
Loading...
Searching...
No Matches
UtilsDateTime.h
1#ifndef HYDROBRICKS_UTILS_DATETIME_H
2#define HYDROBRICKS_UTILS_DATETIME_H
3
4#include <chrono>
5#include <string>
6
7#include "Enums.h"
8#include "Includes.h"
9
20 public:
21 // Convert a structured date-time to MJD (double days).
22 static double ToMJD(int year, int month, int day, int hour = 0, int minute = 0, int second = 0);
23
24 // Convert MJD to structured time.
25 static Time FromMJD(double mjd);
26
27 // Parse date/time string according to TimeFormat; throws InputError on failure.
28 static double ParseToMJD(const std::string& dateStr, TimeFormat format);
29
30 private:
31 // Helpers
32 static std::chrono::sys_days ToSysDays(int year, int month, int day);
33 static void ValidateHMS(int hour, int minute, int second);
34};
35
36#endif // HYDROBRICKS_UTILS_DATETIME_H
Definition UtilsDateTime.h:19
Definition Includes.h:97