0

In one of my application, I get lot of date values from different machines. I wanted to know the timezone information of those machines.

Is there any C function to fetch that information like below ?

-- Asia/Calcutta
--- Africa/Algiers
--- Africa/Addis_Ababa

I found functions like localtime and gmttime which I can use to get the difference between UTC time and local time but is there any way to get the timezone region name ?

phuclv
  • 37,963
  • 15
  • 156
  • 475
sunmoon
  • 1,448
  • 1
  • 15
  • 27
  • 1
    There is no portable and standard C function to get the time-zone. For POSIX systems (like Linux or macOS) see [How do I find the current system timezone?](https://stackoverflow.com/questions/3118582/how-do-i-find-the-current-system-timezone) – Some programmer dude Aug 31 '23 at 06:47
  • Yes! But it tends to be OS-dependent, sorry. Visual Studio (ms windows) uses _get_tzname(). I see dude has provided a competent link to other platforms and ideas. hth – greg spears Sep 03 '23 at 05:22

0 Answers0