Get the Olson TZ name for the local timezone?

前端 未结 11 1355
孤街浪徒
孤街浪徒 2020-11-30 03:19

How do I get the Olson timezone name (such as Australia/Sydney) corresponding to the value given by C\'s localtime call?

This is the value overridden vi

11条回答
  •  情话喂你
    2020-11-30 03:20

    This will get you the time zone name, according to what's in the TZ variable, or localtime file if unset:

    #! /usr/bin/env python
    
    import time
    
    time.tzset
    print time.tzname
    

提交回复
热议问题