diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index 6570e8c..7c7447e 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -743,22 +743,7 @@ Assuming the birthdate is exactly synchronized with TAI (offset by the timezone) auto birthday = to_tai_time(make_zoned(zone, local_days{apr/24/1954} + 10h + 3min - 10s).get_sys_time()); -We have to subtract 10s manually because we want the birthday to be `1954-04-24 18:03:00 TAI` and without that 10s subtraction we have UTC modeled back to 1954 instead of modeling TAI in 1954. - -Another way to do this would be to "reinterpret_cast" the `sys_time` to `tai_time`. This would relieve us from having to know about the 10s constant. This is done with the following syntax: - - auto birthday = tai_seconds{make_zoned(zone, - local_days{apr/24/1954} + 10h + 3min).get_sys_time().time_since_epoch()}; - -Either way, the result is the same. This line: - - std::cout << "born : " << birthday << " TAI \n"; - -will output: - - born : 1942-04-24 18:03:00 TAI - -Then we add the 2Gs in `tai_time` and convert that result back to `sys_time`, and then to a `zoned_time`: +We have to subtract 10s manually because we want the birthday to be `1954-04-24 18:03:00 TAI` and without that 10s subtraction we have UTC modeled back to 1954 instead of modeling TAI in 1954. Then we add the 2Gs in `tai_time` and convert that result back to `sys_time`, and then to a `zoned_time`: auto Day2Gs = make_zoned(zone, to_sys_time(birthday + 2'000'000'000s));