Home > OS >  C declare zoned_time for 1 PM today east coast time
C declare zoned_time for 1 PM today east coast time

Time:04-26

I'm looking for how to declare a time for a configurable number of minutes before 1 pm east coast time on the day of running the program. I've found ways to get a fixed time of the timezone such as:

chrono::zoned_time onePmEastCoastTime ("New York/New York", chrono::sys_days{ 2022y / chrono::April/ 15d } 13h );

How can I declare a configurable time that will match a specific timezone?

CodePudding user response:

It sounds like you want to specify the time in terms of local time as opposed to UTC. The key to this is in the use of local_days vs sys_days.

sys_days is a count of days in UTC.

local_days is a count of days in some local time that can be subsequently paired with a timezone.

Maybe you are looking for:

chrono::minutes m = ...
chrono::zoned_time onePmEastCoastTime{"America/New_York",
      chrono::local_days{ 2022y / chrono::April/ 15d }   13h - m};
  • Related