Re: Segmented Control Widget

2020-11-07 Thread Terence Heaford via use-livecode



> On 5 Nov 2020, at 20:10, J. Landman Gay via use-livecode 
>  wrote:
> 
> I've done this with a custom control group, it should work with a widget too. 
> Calculate the rectangles (or at least the left and right edges) of each 
> segment and in a mouseEnter handler compare the mouseLoc to the rectangles to 
> see which one it's in. Then set the tooltip to the appropriate string. You 
> can also add a mouseMove handler to do the same thing if you want to change 
> tooltips as the mouseLoc changes inside the widget.


I placed the segmented control widget in a group and put a simple

on mouseEnter
beep
end mouseEnter

in the script of the group.

This did not implement a beep sound.
I placed the same script in the segmented control and that did not make a beep 
either.


I read the dictionary for mouseEnter and it does not apply to a group, I assume 
it also does not apply to the segmented control widget.


I then created three standard buttons and placed those in a group.
Placed the above script in the group.
and each time the mouse entered a button it beeped. It did not beep upon 
entering the group.

Is all this the correct behaviour?

If it is then it is not possible to create your own tooltip for a segmented 
control widget unless there is some more fiddling that can be done.

It seems creating your own segmented control may be the only solution.

Any ideas

Thanks

Terry



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Issue with 'beep' on iOS

2020-11-07 Thread Graham Samuel via use-livecode
In my iOS app, I create a special beep sound, as explained in the LC Dictionary 
entry for ‘beep’. It works fine on the Simulator, but on a real phone, there’s 
no sound. Vibration works OK. I have not turned off sound on the phone, and I 
have checked to see if any other controls on the phone might be wrongly set but 
I can’t find any. Ring tones, system sounds, music and sounds from external 
sources work. I seem to remember it worked before I upgraded to iOS 14. Can 
anyone suggest what’s happening?
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Is the DateFormat read only?

2020-11-07 Thread Graham Samuel via use-livecode
I am as confused as anyone else as to what you are trying to do, but just in 
case, this little function seems to work for me to get the ’standard’ UTC date 
format which I have to use in my app to put time stamps into GPX files. It 
apparently produces the correct time zone. Doubtless it could be more elegantly 
coded. 

Hope it helps - who knows?

Graham

function fUTCTime
   local t1,t2,t3
   -- this gets the current time and puts it into UTC format, i.e 
-MM-DDThh:mm:ssTZD
   put word 5 to 6 of the internet date into t3 -- we are interested in the 
time and time zone
   put the long time into t1
   convert t1 to dateItems -- format is ,m,d,h,m,s,day no.
   put (item 1 of t1) & "-" & f2digits(item 2 of t1) & "-" & f2digits(item 3 of 
t1) &"T" & word 1 of t3 into t2
   put word 2 of t3 into t1 -- the time zone indication
   get char 1 of t1 — the code for 0 (zero) is Z, apparently
   if it <> "+" and it <> "-“ then
  put "Z" after t2
   else
  put t1 after t2
   end if
   return t2
end fUTCTime

function f2digits theNum
-- add a leading zero. We don't check if there are more than two digits
   if number of chars of theNum = 1 then
  return ("0" & theNum)
   else
  return theNum
   end if
end f2digits


> On 7 Nov 2020, at 01:34, Alex Tweedly via use-livecode 
>  wrote:
> 
> I don't think it "strips" the TZ info - it simply ignores it. I think the key 
> phrase is in the dictionary as :
> 
>> *Note:* The *convert* command assumes all dates / times are in local time 
>> except for 'the seconds', which is taken to be universal time.
>> 
> So it assume syou date is in local time (regardless of the +0300), and 
> therefore your example returns + for you (I assume you're in the UK, or 
> equivalent,  now). It does the same for me, and returns the date with "+".
> 
> However, the same code run on my LC server (wherever on-rev is these days), 
> changes the +0300 to -0500 - i.e. it's taken as local time where the server 
> is.
> 
> 
> I assume you should be able to do something with the TimeZone library - but 
> I'm struggling to figure that out.
> 
>>local tNow
>>put the seconds into tNow
>>put FromUniversalTime(tNow,"US/Central") into tt
>>put tNow && tt
>>put FromUniversalTime(tNow,"US/Alaska") into tt
>>put CR & tt after msg
> gives me
> 
> 1604709030 1604709030
> 
> 1604709030
> 
> so I don't have a clue  what it was trying to do !?!
> 
> Alex.
> 
> On 06/11/2020 21:28, David Bovill via use-livecode wrote:
>> Why does:
>> 
>> get "Fri, 06 Nov 2020 10:57:37 +0300"
>> convert it to internet date
>> put it
>> 
>> — give
>> "Fri, 06 Nov 2020 10:57:37 +"
>> 
>> Just seems to strip the timezone info?
>> On 30 Oct 2020, 21:29 +, How to use LiveCode 
>> , wrote:
>>> ToUniversalTime
>> ___
>> use-livecode mailing list
>> use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Is the DateFormat read only?

2020-11-07 Thread Alex Tweedly via use-livecode

Thanks Graham. That does indeed work - on your local system.

The issue I am trying to deal with (and maybe it's related to what David 
is doing) is dealing with time zone issues on a LC web server. If you 
want to timestamp when some event happens, you can do that as a UTC 
timestamp using a function like this one of yours; but that leaves you 
two problems.


 - presenting those timestamps back to the user - which should be in 
*their* local time
 - allowing the user to provide their own timestamp - again should be 
local for them.


Most advice I've found via Google, etc. suggests keeping the timestamps 
in UTC, and asking the user to provide their timezone - usually when 
they 'register'. You can then use PHP (or ...) functions to convert a 
date/time between UTC and their local zone.


You might hope to do that in LC using 'convert .. to internet date' - 
but that doesn't work because that conversion (seems to) assume a local 
time, and then simply fill in the time offset for the local system (i.e. 
the problem David reported).


You should be able to do it using the TimeZone library - but I haven't 
figured out how to to do that, or I'm using it wrong, or something. (I 
didn't know about the Timezone library until David mentioned it yesterday.)


I'm currently using an ugly (though working :-) workaround using e.g.

put "America/New_York" into timeZone

*put*shell("TZ=" & timeZone & " date") into tmp

and working it all out from there (assumes Unix server - don't know if 
it works on others).


Alex.



On 07/11/2020 10:27, Graham Samuel via use-livecode wrote:

I am as confused as anyone else as to what you are trying to do, but just in 
case, this little function seems to work for me to get the ’standard’ UTC date 
format which I have to use in my app to put time stamps into GPX files. It 
apparently produces the correct time zone. Doubtless it could be more elegantly 
coded.

Hope it helps - who knows?

Graham

function fUTCTime
local t1,t2,t3
-- this gets the current time and puts it into UTC format, i.e 
-MM-DDThh:mm:ssTZD
put word 5 to 6 of the internet date into t3 -- we are interested in the 
time and time zone
put the long time into t1
convert t1 to dateItems -- format is ,m,d,h,m,s,day no.
put (item 1 of t1) & "-" & f2digits(item 2 of t1) & "-" & f2digits(item 3 of t1) 
&"T" & word 1 of t3 into t2
put word 2 of t3 into t1 -- the time zone indication
get char 1 of t1 — the code for 0 (zero) is Z, apparently
if it <> "+" and it <> "-“ then
   put "Z" after t2
else
   put t1 after t2
end if
return t2
end fUTCTime

function f2digits theNum
-- add a leading zero. We don't check if there are more than two digits
if number of chars of theNum = 1 then
   return ("0" & theNum)
else
   return theNum
end if
end f2digits



On 7 Nov 2020, at 01:34, Alex Tweedly via use-livecode 
 wrote:

I don't think it "strips" the TZ info - it simply ignores it. I think the key 
phrase is in the dictionary as :


*Note:* The *convert* command assumes all dates / times are in local time 
except for 'the seconds', which is taken to be universal time.


So it assume syou date is in local time (regardless of the +0300), and therefore your 
example returns + for you (I assume you're in the UK, or equivalent,  now). It does 
the same for me, and returns the date with "+".

However, the same code run on my LC server (wherever on-rev is these days), 
changes the +0300 to -0500 - i.e. it's taken as local time where the server is.


I assume you should be able to do something with the TimeZone library - but I'm 
struggling to figure that out.


local tNow
put the seconds into tNow
put FromUniversalTime(tNow,"US/Central") into tt
put tNow && tt
put FromUniversalTime(tNow,"US/Alaska") into tt
put CR & tt after msg

gives me

1604709030 1604709030

1604709030

so I don't have a clue  what it was trying to do !?!

Alex.

On 06/11/2020 21:28, David Bovill via use-livecode wrote:

Why does:

get "Fri, 06 Nov 2020 10:57:37 +0300"
convert it to internet date
put it

— give
"Fri, 06 Nov 2020 10:57:37 +"

Just seems to strip the timezone info?
On 30 Oct 2020, 21:29 +, How to use LiveCode 
, wrote:

ToUniversalTime

___
use-livecode mailing list
use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.r

Re: IOS Screen resizing /EXACT FIT not working as before

2020-11-07 Thread Andrew at MidWest Coast Media via use-livecode
I’m having a similar issue with “letterbox” on an a project. It has fit fine 
for years: exact fit on older devices with black bars on top/bottom of newer 
devices. But when I rebuild now, it shows black bars on all 4 sides of an 
iPhone 11. (old build currently on AppStore renders just on top/bottom)

Unfortunately because of how it was designed (for 5s device size with NO resize 
handler), “exactFit” will kill navigation on modern devices. The project needs 
a UI overhaul, and I’m using this as motivation for the client, but it seems 
that somewhere a change was made on how iOS device sizes are determined. I 
noticed a lot of chatter recently about this affecting the iPhone Plus models 
when zoomed. Perhaps Apple made a change in Xcode 11 if nothing has changed in 
LiveCode.

-Andrew Bell
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Is the DateFormat read only?

2020-11-07 Thread matthias rebbe via use-livecode
Alex,

i've posted already some info about how to use the time zone library in 
Livecode server in my comment to David's post "Aw: Basic question: Time Zone 
Library".

Here it is again and a little bit more detailed.

1. copy the folder com.livecode.library.timezone from the LC extensions folder 
to your webserver into a folder extensions. The extensions folder can be found 
in the App Bundle on macOS or in the windows program folder
e.g. C:\Program Files (x86)\RunRev\LiveCode Business 9.6.1

2. place your .lc script in the same folder where the extensions folder exists.

3. configure/set the path where the shared library for your server os is 
located (see line 3 in the sample script below)
4. load the extension module.lcm (see line 4 in the sample script below)

The following script uses the time zone library to output the available time 
zones

" in tTZ
put tTZ
?>



-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 07.11.2020 um 13:57 schrieb Alex Tweedly via use-livecode 
> :
> 
> Thanks Graham. That does indeed work - on your local system.
> 
> The issue I am trying to deal with (and maybe it's related to what David is 
> doing) is dealing with time zone issues on a LC web server. If you want to 
> timestamp when some event happens, you can do that as a UTC timestamp using a 
> function like this one of yours; but that leaves you two problems.
> 
>  - presenting those timestamps back to the user - which should be in *their* 
> local time
>  - allowing the user to provide their own timestamp - again should be local 
> for them.
> 
> Most advice I've found via Google, etc. suggests keeping the timestamps in 
> UTC, and asking the user to provide their timezone - usually when they 
> 'register'. You can then use PHP (or ...) functions to convert a date/time 
> between UTC and their local zone.
> 
> You might hope to do that in LC using 'convert .. to internet date' - but 
> that doesn't work because that conversion (seems to) assume a local time, and 
> then simply fill in the time offset for the local system (i.e. the problem 
> David reported).
> 
> You should be able to do it using the TimeZone library - but I haven't 
> figured out how to to do that, or I'm using it wrong, or something. (I didn't 
> know about the Timezone library until David mentioned it yesterday.)
> 
> I'm currently using an ugly (though working :-) workaround using e.g.
> 
> put "America/New_York" into timeZone
> 
> *put*shell("TZ=" & timeZone & " date") into tmp
> 
> and working it all out from there (assumes Unix server - don't know if it 
> works on others).
> 
> Alex.
> 
> 
> 
> On 07/11/2020 10:27, Graham Samuel via use-livecode wrote:
>> I am as confused as anyone else as to what you are trying to do, but just in 
>> case, this little function seems to work for me to get the ’standard’ UTC 
>> date format which I have to use in my app to put time stamps into GPX files. 
>> It apparently produces the correct time zone. Doubtless it could be more 
>> elegantly coded.
>> 
>> Hope it helps - who knows?
>> 
>> Graham
>> 
>> function fUTCTime
>>local t1,t2,t3
>>-- this gets the current time and puts it into UTC format, i.e 
>> -MM-DDThh:mm:ssTZD
>>put word 5 to 6 of the internet date into t3 -- we are interested in the 
>> time and time zone
>>put the long time into t1
>>convert t1 to dateItems -- format is ,m,d,h,m,s,day no.
>>put (item 1 of t1) & "-" & f2digits(item 2 of t1) & "-" & f2digits(item 3 
>> of t1) &"T" & word 1 of t3 into t2
>>put word 2 of t3 into t1 -- the time zone indication
>>get char 1 of t1 — the code for 0 (zero) is Z, apparently
>>if it <> "+" and it <> "-“ then
>>   put "Z" after t2
>>else
>>   put t1 after t2
>>end if
>>return t2
>> end fUTCTime
>> 
>> function f2digits theNum
>> -- add a leading zero. We don't check if there are more than two digits
>>if number of chars of theNum = 1 then
>>   return ("0" & theNum)
>>else
>>   return theNum
>>end if
>> end f2digits
>> 
>> 
>>> On 7 Nov 2020, at 01:34, Alex Tweedly via use-livecode 
>>>  wrote:
>>> 
>>> I don't think it "strips" the TZ info - it simply ignores it. I think the 
>>> key phrase is in the dictionary as :
>>> 
 *Note:* The *convert* command assumes all dates / times are in local time 
 except for 'the seconds', which is taken to be universal time.
 
>>> So it assume syou date is in local time (regardless of the +0300), and 
>>> therefore your example returns + for you (I assume you're in the UK, or 
>>> equivalent,  now). It does the same for me, and returns the date with 
>>> "+".
>>> 
>>> However, the same code run on my LC server (wherever on-rev is these days), 
>>> changes the +0300 to -0500 - i.e. it's taken as local time where the server 
>>> is.
>>> 
>>> 
>>> I assume you should be able to do something with the TimeZone library - but 
>>> I'm struggling to figure that out.
>>> 
local tNow
put the seconds int

Re: Is the DateFormat read only?

2020-11-07 Thread Alex Tweedly via use-livecode
Thank you Matthias. Those detailed instructions will come in handy for 
me - when/if I get that far.


The problem I mentioned a couple of emails ago in this thread was in the 
IDE - haven\t yet got as far as doing it on the server.


I tested out the TimeZone library with a couple of randomly chosen 
timezones - and they all came back incorrect (i.e. unchanged from UTC 
even though the timezones should have been different). I know that if 
you pass in a timezone that is not in the local machine's database, it 
will silently return the UTC value - but that's not the case here.


I've now looked at it more closely - some of these timezones give the 
right answer, some give the wrong answer - though they are all in the 
TimeZones() list.


All on my MacBook Pro, OSX 10.13.6, LC 9.6 ...


   local tTimeZones, tAllTheTimeZones
   put timezones() into tAllTheTimeZones
   put "UTC" & CR after tTimeZones
   put "America/New_York" & CR after tTimeZones
   put "America/Anchorage" & CR after tTimeZones
   put "junktotest" & CR after tTimeZones
   put "US/Central" & CR after tTimeZones
   put "US/Alaska" & CR after tTimeZones

   repeat for each line L in tTimeZones
  if L is among the lines of tAllTheTimeZones then
 put L && FromUniversalTime(the seconds,L) &CR after msg
  else
 put L && "is not in the database" &CR after msg
  end if
   end repeat

gives


UTC 1604762435
America/New_York 1604744435
America/Anchorage 1604730035
junktotest is not in the database
US/Central 1604762435
US/Alaska 1604762435

Note the last two (which happened to be the ones I chose in my earlier 
test) wrongly show the UTC time, though they are clearly in the 
TimeZones() list.


Maybe just a bug and I should report it ?

Alex

On 07/11/2020 14:36, matthias rebbe via use-livecode wrote:

Alex,

i've posted already some info about how to use the time zone library in Livecode server 
in my comment to David's post "Aw: Basic question: Time Zone Library".

Here it is again and a little bit more detailed.

1. copy the folder com.livecode.library.timezone from the LC extensions folder 
to your webserver into a folder extensions. The extensions folder can be found 
in the App Bundle on macOS or in the windows program folder
e.g. C:\Program Files (x86)\RunRev\LiveCode Business 9.6.1

2. place your .lc script in the same folder where the extensions folder exists.

3. configure/set the path where the shared library for your server os is 
located (see line 3 in the sample script below)
4. load the extension module.lcm (see line 4 in the sample script below)

The following script uses the time zone library to output the available time 
zones

" in tTZ
put tTZ
?>



-
Matthias Rebbe
Life Is Too Short For Boring Code


Am 07.11.2020 um 13:57 schrieb Alex Tweedly via use-livecode 
:

Thanks Graham. That does indeed work - on your local system.

The issue I am trying to deal with (and maybe it's related to what David is 
doing) is dealing with time zone issues on a LC web server. If you want to 
timestamp when some event happens, you can do that as a UTC timestamp using a 
function like this one of yours; but that leaves you two problems.

  - presenting those timestamps back to the user - which should be in *their* 
local time
  - allowing the user to provide their own timestamp - again should be local 
for them.

Most advice I've found via Google, etc. suggests keeping the timestamps in UTC, 
and asking the user to provide their timezone - usually when they 'register'. 
You can then use PHP (or ...) functions to convert a date/time between UTC and 
their local zone.

You might hope to do that in LC using 'convert .. to internet date' - but that 
doesn't work because that conversion (seems to) assume a local time, and then 
simply fill in the time offset for the local system (i.e. the problem David 
reported).

You should be able to do it using the TimeZone library - but I haven't figured 
out how to to do that, or I'm using it wrong, or something. (I didn't know 
about the Timezone library until David mentioned it yesterday.)

I'm currently using an ugly (though working :-) workaround using e.g.

put "America/New_York" into timeZone

*put*shell("TZ=" & timeZone & " date") into tmp

and working it all out from there (assumes Unix server - don't know if it works 
on others).

Alex.



On 07/11/2020 10:27, Graham Samuel via use-livecode wrote:

I am as confused as anyone else as to what you are trying to do, but just in 
case, this little function seems to work for me to get the ’standard’ UTC date 
format which I have to use in my app to put time stamps into GPX files. It 
apparently produces the correct time zone. Doubtless it could be more elegantly 
coded.

Hope it helps - who knows?

Graham

function fUTCTime
local t1,t2,t3
-- this gets the current time and puts it into UTC format, i.e 
-MM-DDThh:mm:ssTZD
put word 5 to 6 of the internet date into t3 -- we are interested in the 
time and time zone
put t

Re: IOS Screen resizing /EXACT FIT not working as before

2020-11-07 Thread Lagi Pittas via use-livecode
Hi

I was told today that the App is unusable on smaller iphones on which it
was originally designed - ny smaller I mean 6 and 7
It is usable on the bigger screens (albeit it looks "wrong")  but a lot of
people still stick with smaller screens.

Lagi


On Sat, 7 Nov 2020 at 14:18, Andrew at MidWest Coast Media via use-livecode
 wrote:

> I’m having a similar issue with “letterbox” on an a project. It has fit
> fine for years: exact fit on older devices with black bars on top/bottom of
> newer devices. But when I rebuild now, it shows black bars on all 4 sides
> of an iPhone 11. (old build currently on AppStore renders just on
> top/bottom)
>
> Unfortunately because of how it was designed (for 5s device size with NO
> resize handler), “exactFit” will kill navigation on modern devices. The
> project needs a UI overhaul, and I’m using this as motivation for the
> client, but it seems that somewhere a change was made on how iOS device
> sizes are determined. I noticed a lot of chatter recently about this
> affecting the iPhone Plus models when zoomed. Perhaps Apple made a change
> in Xcode 11 if nothing has changed in LiveCode.
>
> -Andrew Bell
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
KIndest Regards Lagi
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Basic question: Time Zone Library

2020-11-07 Thread David Bovill via use-livecode
Thanks Matthias - very helpful. Looks like there is no dictionary entry for 
revLibraryMapping :(
On 6 Nov 2020, 23:11 +, matthias rebbe via use-livecode 
, wrote:
> Hi,
>
> i am not sure if this is still the way how to do it with newer LC Server 
> versions, but at least it still works with LC 9.6.1
>
> First copy the folder of of the time zone library to your server for example 
> into a folder extension
>
> Then, to use the library you'll have to put the following 2 lines before your 
> time zone specific code.
>
> set the revLibraryMapping["tz"] to 
> "/home/ua829968/public_html/livecode.dermattes.de/tz-test/extensions/com.livecode.library.timezone/code/x86_64-linux/tz.so"
> load extension from file 
> "./extensions/com.livecode.library.timezone/module.lcm"
> //here comes your timezone script
>
>
>
> In the first line you define where the needed shared libraries are located. 
> It must contain the complete path to the shared libraries. In the above 
> example the shared library for 64bit Linux is used. The second line then 
> loads the extension.
>
> Mark Waddingham provided that information here 2 years ago
> https://www.mail-archive.com/use-livecode@lists.runrev.com/msg97605.html
>
> Regards,
>
> Matthias
>
>
>
>
>
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
>
> > Am 06.11.2020 um 23:29 schrieb David Bovill via use-livecode 
> > :
> >
> > Just created a handler that I want to use in a Livecode server that uses 
> > the Time Zone Library handler TimeZones(). So:
> >
> > 1. How do I find where the library is?
> > 2. How do I add it so the server code can use it?
> >
> > On 6 Nov 2020, 21:28 +, How to use LiveCode 
> > , wrote:
> > >
> > > ToUniversalTime
> > ___
> > use-livecode mailing list
> > use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Is the DateFormat read only?

2020-11-07 Thread David Bovill via use-livecode
Looks like a bug to me. So I’d say yes?

I’m pretty puzzled why convert does not work with internet date. It seems a bit 
of a waste to make the internet date a format that you can only display and not 
 manipulate? Tests here indicate that converting an internet date to seconds 
makes no difference with regard to the time zone bit you include - to 
illustrate here is a function that I had to make to convert internet dates:
function date_GetInternetSeconds iDate
    put word -1 of iDate into iDateOffset
    convert iDate to seconds -- this ignores the last "+0050" 
iDateOffset bit
    _AddInternetDateOffset iDate, iDateOffset
    return iDate
end date_GetInternetSeconds

private command _AddInternetDateOffset @dateInSeconds, iDateOffset
    put char 2 to 3 of iDateOffset into sHours
    put char 4 to 5 of iDateOffset into sMin
    --
    if char 1 of iDateOffset = "+"then
            add sHours * 60*60 to dateInSeconds
            add sMin * 60 to dateInSeconds
        else
            subtract sHours * 60*60 from dateInSeconds
            subtract sMin * 60 from dateInSeconds
    end if
end_AddInternetDateOffset

Does this really make sense?
On 7 Nov 2020, 14:37 +, matthias rebbe via use-livecode 
, wrote:
> Alex,
>
> i've posted already some info about how to use the time zone library in 
> Livecode server in my comment to David's post "Aw: Basic question: Time Zone 
> Library".
>
> Here it is again and a little bit more detailed.
>
> 1. copy the folder com.livecode.library.timezone from the LC extensions 
> folder to your webserver into a folder extensions. The extensions folder can 
> be found in the App Bundle on macOS or in the windows program folder
> e.g. C:\Program Files (x86)\RunRev\LiveCode Business 9.6.1
>
> 2. place your .lc script in the same folder where the extensions folder 
> exists.
>
> 3. configure/set the path where the shared library for your server os is 
> located (see line 3 in the sample script below)
> 4. load the extension module.lcm (see line 4 in the sample script below)
>
> The following script uses the time zone library to output the available time 
> zones
>
>  put the folder into tBasePath
> set the revLibraryMapping["tz"] to tBasePath 
> &"/extensions/com.livecode.library.timezone/code/x86_64-linux/tz.so"
> load extension from file tBasePath & 
> "/extensions/com.livecode.library.timezone/module.lcm"
> put timezones() into tTZ
> replace return with "" in tTZ
> put tTZ
> ?>
>
>
>
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
>
> > Am 07.11.2020 um 13:57 schrieb Alex Tweedly via use-livecode 
> > :
> >
> > Thanks Graham. That does indeed work - on your local system.
> >
> > The issue I am trying to deal with (and maybe it's related to what David is 
> > doing) is dealing with time zone issues on a LC web server. If you want to 
> > timestamp when some event happens, you can do that as a UTC timestamp using 
> > a function like this one of yours; but that leaves you two problems.
> >
> > - presenting those timestamps back to the user - which should be in *their* 
> > local time
> > - allowing the user to provide their own timestamp - again should be local 
> > for them.
> >
> > Most advice I've found via Google, etc. suggests keeping the timestamps in 
> > UTC, and asking the user to provide their timezone - usually when they 
> > 'register'. You can then use PHP (or ...) functions to convert a date/time 
> > between UTC and their local zone.
> >
> > You might hope to do that in LC using 'convert .. to internet date' - but 
> > that doesn't work because that conversion (seems to) assume a local time, 
> > and then simply fill in the time offset for the local system (i.e. the 
> > problem David reported).
> >
> > You should be able to do it using the TimeZone library - but I haven't 
> > figured out how to to do that, or I'm using it wrong, or something. (I 
> > didn't know about the Timezone library until David mentioned it yesterday.)
> >
> > I'm currently using an ugly (though working :-) workaround using e.g.
> >
> > put "America/New_York" into timeZone
> >
> > *put*shell("TZ=" & timeZone & " date") into tmp
> >
> > and working it all out from there (assumes Unix server - don't know if it 
> > works on others).
> >
> > Alex.
> >
> >
> >
> > On 07/11/2020 10:27, Graham Samuel via use-livecode wrote:
> > > I am as confused as anyone else as to what you are trying to do, but just 
> > > in case, this little function seems to work for me to get the ’standard’ 
> > > UTC date format which I have to use in my app to put time stamps into GPX 
> > > files. It apparently produces the correct time zone. Doubtless it could 
> > > be more elegantly coded.
> > >
> > > Hope it helps - who knows?
> > >
> > > Graham
> > >
> > > function fUTCTime
> > > local t1,t2,t3
> > > -- this gets the current time and puts it into UTC format, i