System Time Zone

Richmond richmondmathewson at gmail.com
Wed Sep 14 13:20:39 EDT 2022


https://use-livecode.runrev.narkive.com/PhNgjt9Q/time-problems-with-daylight-saving

On 14.09.22 19:01, Richmond wrote:
> From an offset from GMT it is easy enough with this:
>
> https://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png 
>
>
> to run up a listField with timezones and their countries as a sort of 
> ad-hoc lookup table.
>
> On 14.09.22 18:38, matthias rebbe via use-livecode wrote:
>> The original poster does not want to have the offset, but the time 
>> zone country/city and he already had a solution with apple script.
>> I provided a solution just with the shell function.
>>
>>
>>> Am 14.09.2022 um 17:21 schrieb Richmond via use-livecode 
>>> <use-livecode at lists.runrev.com>:
>>>
>>> That seems a bit unnecessary as 'internet date' produces a format 
>>> that includes the GMT offset.
>>>
>>> So when I write this in the messageBox:  put the internet date
>>>
>>> I get:
>>>
>>> Wed, 14 Sep 2022 18:19:18 +0300
>>>
>>> and, obviously, from the +0300 it is dead easy to work out
>>>
>>> my system time zone.
>>>
>>> Love, Richmond.
>>>
>>>
>>>
>>>
>>> On 14.09.22 18:09, matthias rebbe via use-livecode wrote:
>>>> Does your app has preferences the user can enter? Why not allow him 
>>>> to enter also the sudo password?
>>>> You could then use that to execute the following shell command:
>>>>
>>>> put shell("echo <password> | sudo -S /usr/sbin/systemsetup 
>>>> -gettimezone")
>>>>
>>>> replace <password> with the password in preferences. No need to use 
>>>> Applescript.
>>>>
>>>> Regards,
>>>> Matthias
>>>>
>>>>
>>>>
>>>>> Am 14.09.2022 um 15:50 schrieb Bob Cole via use-livecode 
>>>>> <use-livecode at lists.runrev.com>:
>>>>>
>>>>> Just for the sake of completeness, there is a way to get the time 
>>>>> zone with AppleScript but it requires Administrator Privileges. 
>>>>> The MacOS pops up a request to allow the “do as AppleScript” 
>>>>> script to access the systemsetup function. That manual step will 
>>>>> interfere with the flow of the program.
>>>>>
>>>>> Create a field “Statements” with this AppleScript:
>>>>>
>>>>> do shell script "/usr/sbin/systemsetup -gettimezone" with 
>>>>> administrator privileges
>>>>>
>>>>> and put the following code in the script of a button:
>>>>>
>>>>> on mouseUp
>>>>>    do field "Statements" as "AppleScript"
>>>>>    put the result into tResult
>>>>>    set the itemDelimiter to space
>>>>>    delete word 1 to 2 in tResult
>>>>>    delete the last char of tResult
>>>>>    put tResult into message box
>>>>> end request
>>>>>
>>>>> Tested in two time zones with these results:
>>>>> America/Chicago
>>>>> America/New_York
>>>>>
>>>>> Bob
>>>>>
>>>>>> It's the, "America/Los_Angeles" bit I am trying to find a way to 
>>>>>> grok.
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your 
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your 
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your 
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list