Post Reply 
epoch Prime
01-06-2018, 10:55 PM
Post: #41
RE: epoch Prime
(01-06-2018 10:07 PM)salvomic Wrote:  I would like to do so, and sometimes I do it truly, but mostly I don't find time to write or I don't find ...paper. Smile
However it works!

Salvo

Without paper I would be pretty lost.

https://i.imgur.com/mzEnxa6.jpg
https://i.imgur.com/6FyEq13.jpg

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
01-06-2018, 11:07 PM
Post: #42
RE: epoch Prime
(01-06-2018 09:01 PM)salvomic Wrote:  or we simply could ignore that problem and only say to the user (for now with comments, but for problems like that I do hope a real *user help* system for HPPPL programs!) that it can use this simple syntax, using the system variables Date and Time...
Code:
epoch(Date, Time, timezone)
to get current date and time, and to choose only his time zone.

That's the way I would have done it myself. ;-)

I don't see the need for a special epoch(now) function if there is a general epoch(dat, tim, zone) function where the first two parameters can easily be set to the current date and time. And maybe sometime the Prime OS will feature a global timezone variable as well.

(01-06-2018 09:01 PM)salvomic Wrote:  In this link there is the simplified version of the program.

The comment should say that "zone" is the timezone relative to UTC in hours. Currently the comment only says that 0 means UTC.

There is a line that may not always work properly: IF tim<>Time THEN tim:=HMS→(tim); END;
This checks if the given parameter equals the current time or not (this decides whether a HMS conversion is required or not). What if both differ by a fraction of a second? Or a second?
I think it's a better idea to advise the user to call the function with →HMS(Time) so that the time parameter always (!) has to be specified in the same hh.mmss format.

And finally... you may have confused "e.g." and "i.e.".

Otherwise it looks fine to me.

Dieter
Find all posts by this user
Quote this message in a reply
01-06-2018, 11:24 PM
Post: #43
RE: epoch Prime
Another workaround for optional parameters would have been to use the system timezone.
It would be inconvenient to have to change the system timezone if you often need to, but for occasional use that would be a good way of handling a timezone change as an optional argument.

But I don't see a timezone setting next to the time on the Prime Home Settings screen.
As I live in UTC+0 I am not sure whether the Prime knows its timezone or not, but I don't see a setting for it.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
01-07-2018, 09:26 AM (This post was last modified: 01-07-2018 06:35 PM by salvomic.)
Post: #44
RE: epoch Prime
(01-06-2018 11:07 PM)Dieter Wrote:  That's the way I would have done it myself. ;-)
Thank you!
(01-06-2018 11:07 PM)Dieter Wrote:  I don't see the need for a special epoch(now) function if there is a general epoch(dat, tim, zone) function where the first two parameters can easily be set to the current date and time. And maybe sometime the Prime OS will feature a global timezone variable as well.
yes, it would be useful to have a timezone setting in the Prime OS. It it were in the Prime we can also put the last parameter as "optional"...
[/quote]
(01-06-2018 11:07 PM)Dieter Wrote:  The comment should say that "zone" is the timezone relative to UTC in hours. Currently the comment only says that 0 means UTC.
you're right, I'll correct it soon.
(01-06-2018 11:07 PM)Dieter Wrote:  There is a line that may not always work properly: IF tim<>Time THEN tim:=HMS→(tim); END;
This checks if the given parameter equals the current time or not (this decides whether a HMS conversion is required or not). What if both differ by a fraction of a second? Or a second?
I think it's a better idea to advise the user to call the function with →HMS(Time) so that the time parameter always (!) has to be specified in the same hh.mmss format.
Right. I made that line in few time, just to try. Its goal is to distinguish between the "Time" builtin variable (HMS) and the "time" variable that the user choose, and I would like actually offer the opportunity to choose both HMS and H.mmss input seamless...
(01-06-2018 11:07 PM)Dieter Wrote:  And finally... you may have confused "e.g." and "i.e.".
Smile That's "for example"... We Italians say and think "per esempio" (p.e.) and when I translate into English sometimes I put "e.g." (exempli gratia, Latin) and sometimes I confound the abbreviation with "i.e" (that in Latin is "id est", "that is", Italian "cioé"). They are surely not the same expression, but their semantic field is crossed, at least in my two native languages, Italian and Latin...
[/quote]
(01-06-2018 11:07 PM)Dieter Wrote:  Otherwise it looks fine to me.

Thank you again, Dieter. Your help is much appreciated.

(01-06-2018 11:24 PM)StephenG1CMZ Wrote:  Another workaround for optional parameters would have been to use the system timezone.
It would be inconvenient to have to change the system timezone if you often need to, but for occasional use that would be a good way of handling a timezone change as an optional argument.

But I don't see a timezone setting next to the time on the Prime Home Settings screen.
As I live in UTC+0 I am not sure whether the Prime knows its timezone or not, but I don't see a setting for it.

yes, Stephen, there is no setting for timezone. I do hope that in a future version of the OS there will be one, as it would be important.
Here in Italy timezone is +1 (+2 in Summer), so I can manage with timezone all time...

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-07-2018, 06:22 PM
Post: #45
RE: epoch Prime
(01-07-2018 09:26 AM)salvomic Wrote:  Smile That's "for example"... We Italians say and think "per esempio" (p.e.) and when I translate into English sometimes I put "e.g." (example gratia, Latin) and sometimes I confound the abbreviation with "i.e" (that in Latin is "id est", "that is", Italian "cioé"). They are surely not the same expression, but their semantic field is crossed, at least in my two native languages, Italian and Latin...

What? Latin is your native language? Tell me more about this.

Dieter
Find all posts by this user
Quote this message in a reply
01-07-2018, 06:28 PM (This post was last modified: 01-07-2018 06:33 PM by salvomic.)
Post: #46
RE: epoch Prime
(01-07-2018 06:22 PM)Dieter Wrote:  What? Latin is your native language? Tell me more about this.

I'm also a writer (historical books and poetry) and I had classical studies, so Latin and (ancient) Greek are two languages that I use often (to translate mostly). After many years, maybe in my mental firmware often I think directly in Latin, if possible Smile
Definitely is not so easy to speak all daily matters in that language, I'm trying doing it (for joke and passion also); however, for those arguments in which there are no terms I revert to Italian, more easy to think immediately ;-)

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: