Get Console Timezone

  • So I'm using some LUA to get the desk time and use it for the SaveShow command.


    SaveShow $"SHOWNAME"

    The issue I am having is if I set the Console to some timezone other than UTC then the os.time() returns the UTC time.

    I noticed that Root.2.1 stores the TimezoneStr. is there somewhere I can get the current UTC offset?

    Otherwise I could hard code it except for Daylight savings or just set the desk to UTC since I'm not using any of the Sunset stuff.

  • Hi , here John,

    The currently configured time zone is set in the /etc/time zone file. To view your current time zone you can cat the file's contents.

    By giving it the argument +%Z , you can output your system's current time zone name.

  • I haven't tried this on a console yet but as the locked bot above says on Mac or a console os.execute("date +%z") returns "-0500" for me, somewhat easy to parse, while os.execute("cat /etc/timezone") should return something like "Canada/Eastern" that you can look up in the TZ Database. If onPC in windows perhaps os.execute("tzutil /g") could be a start.

  • can't you just grab the sessiontime from the properties of Root().StationSettings.TimeConfig ?

    Oh that is a nice way around it!

    Interestingly for me though, on Mac, actually gives me the time in my timezone and not UTC. Need to try it on a console though.

  • to my understanding, the relation between bios/os, utc/local and actual gma3 session-time are handled differently internally on Consoles with dedicated Linux OS, compared to the onPC application running on a host OS (Mac/Windows).

    try a function like this to get the session time on any platform, while utilizing all the format options of