How can a Windows program temporarily change its time zone?

后端 未结 8 1809
清酒与你
清酒与你 2021-02-05 20:45

I\'ve written a function to return the time_t value corresponding to midnight on a given day. When there is no midnight for a given day, it returns the earliest tim

8条回答
  •  星月不相逢
    2021-02-05 21:03

    I have exactly the same requirement:

    ->some processes must be stuck to UTC and others to some timezone different from the Windows system timezone

    After months of (interrupted) study I fall to the conclusion that on Windows it is only possible to set "UTC" or "current" system time zone. So only the following may be done:

         - set TZ="UTC" 
         - unset TZ
    

提交回复
热议问题