Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
BroadcastTime.cxx
Go to the documentation of this file.
1
35#ifndef _POSIX_C_SOURCE
36#define _POSIX_C_SOURCE 200112L
37#endif
38
40
41namespace openlcb
42{
43
44//
45// BroadcastTimeClient::clear_timezone
46//
48{
49#ifndef ESP_PLATFORM
50 setenv("TZ", "GMT0", 1);
51 tzset();
52#endif
53}
54
55//
56// BroadcastTimeClient::set_data_year_str
57//
58void BroadcastTime::set_date_year_str(const char *date_year)
59{
60 int year, month, day;
61 if (BroadcastTimeDefs::string_to_date(date_year, &year, &month, &day))
62 {
63 // date valid
64 set_date(month, day);
66 }
67}
68
69} // namespace openlcb
int year()
Get the year.
Definition TimeBase.hxx:157
void clear_timezone()
Reset our process local timezone environment to GMT0.
void set_year(int year)
Set the time in seconds since the system Epoch.
void set_date_year_str(const char *date_year)
Set the date and year from a C string.
void set_date(int month, int day)
Set the time in seconds since the system Epoch.
static bool string_to_date(const std::string &sdate, int *year, int *month, int *day)
Converts a (user-provided) string "Mmm dd, yyyy" to date.