Post Reply 
epoch Prime
01-06-2018, 07:58 PM (This post was last modified: 01-06-2018 08:04 PM by salvomic.)
Post: #33
RE: epoch Prime
(01-06-2018 06:26 PM)Dieter Wrote:  What? Nobody told you? Sure I did! Didn't you read my post?
Sorry Dieter, I had closed eyes Sad - and thanks you! ;-)

(01-06-2018 06:26 PM)Dieter Wrote:  I think it's better that the timezone is not optional but required. And this "magic" number is not that magic – it's simply your local timezone. We can safely assume that virtually everyone who uses such a program for converting date and time is aware of his local timezone.
Dieter

I meant "magic number" for data and time, as is not easy to get optional arguments... Not for timezone: for that I thought to put 0, UTC, not 1 (my time zone)... However I'll agree to make timezone not optional.
I would like to eliminate soon that "magic numbers", but also to offer the user the option to input his preferred data or the current one, without make two different functions...

So, how to do better?

(01-06-2018 06:54 PM)StephenG1CMZ Wrote:  A liitle coding tip...

Using -1 as a flag for now is not recommended, but not just because -1 is a "magic number". Magic numbers make the code difficult to maintain, but the code still works.
yes, I know, but, as I said, if it is not possible to get optional arguments, I must "invent" something to do ;-)
(01-06-2018 06:54 PM)StephenG1CMZ Wrote:  Another potential problem is that the Get Date code is duplicated in both procedures...so if the Prime OS changes, only one instance of the code might be changed...or even none, since it is not obvious that either procedure needs to discover Now, rather than just use a date. (Historically the Time/Teval procedure has changed on the Prime).
A much better solution is to keep the discovery of Now separate from the other code that works with any date,
I agree. Effectively I should rewrite that code in that way...
(01-06-2018 06:54 PM)StephenG1CMZ Wrote:  Of course, when putting together something that works, and checking that your algorithm works well enough, it is easy to forget that your code might not be used alone, and might be operating with other procedures, which might also be calculating now, but differently.

and you are right: I too want to offer a code that's usable also in other programs as input.
So, I'm reading again your, Dieter's and other post with advise, and I'm here to have other help by you all to make better the code, however without "complicate" it too much...

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 


Messages In This Thread
epoch Prime - salvomic - 01-05-2018, 05:00 PM
RE: epoch Prime - pier4r - 01-05-2018, 06:03 PM
RE: epoch Prime - Dieter - 01-05-2018, 07:30 PM
RE: epoch Prime - salvomic - 01-05-2018, 07:42 PM
RE: epoch Prime - Dieter - 01-05-2018, 07:51 PM
RE: epoch Prime - salvomic - 01-05-2018, 08:07 PM
RE: epoch Prime - Dieter - 01-05-2018, 08:47 PM
RE: epoch Prime - salvomic - 01-05-2018, 09:10 PM
RE: epoch Prime - Dieter - 01-05-2018, 09:27 PM
RE: epoch Prime - salvomic - 01-05-2018, 09:36 PM
RE: epoch Prime - Dieter - 01-05-2018, 10:07 PM
RE: epoch Prime - salvomic - 01-05-2018, 10:16 PM
RE: epoch Prime - Dieter - 01-05-2018, 10:48 PM
RE: epoch Prime - pier4r - 01-05-2018, 09:40 PM
RE: epoch Prime - salvomic - 01-05-2018, 09:44 PM
RE: epoch Prime - Dieter - 01-05-2018, 09:56 PM
RE: epoch Prime - salvomic - 01-05-2018, 06:17 PM
RE: epoch Prime - salvomic - 01-05-2018, 11:26 PM
RE: epoch Prime - Dieter - 01-06-2018, 08:53 AM
RE: epoch Prime - salvomic - 01-06-2018, 09:28 AM
RE: epoch Prime - Dieter - 01-06-2018, 09:41 AM
RE: epoch Prime - Didier Lachieze - 01-06-2018, 09:50 AM
RE: epoch Prime - StephenG1CMZ - 01-06-2018, 09:40 AM
RE: epoch Prime - pier4r - 01-06-2018, 10:46 AM
RE: epoch Prime - Dieter - 01-06-2018, 12:42 PM
RE: epoch Prime - salvomic - 01-06-2018, 01:07 PM
RE: epoch Prime - salvomic - 01-06-2018, 02:45 PM
RE: epoch Prime - Dieter - 01-06-2018, 06:26 PM
RE: epoch Prime - StephenG1CMZ - 01-06-2018, 08:26 PM
RE: epoch Prime - Dieter - 01-06-2018, 08:37 PM
RE: epoch Prime - pier4r - 01-06-2018, 09:59 PM
RE: epoch Prime - salvomic - 01-06-2018, 10:07 PM
RE: epoch Prime - pier4r - 01-06-2018, 10:55 PM
RE: epoch Prime - pier4r - 01-06-2018, 03:28 PM
RE: epoch Prime - salvomic - 01-06-2018, 03:45 PM
RE: epoch Prime - salvomic - 01-06-2018, 04:10 PM
RE: epoch Prime - StephenG1CMZ - 01-06-2018, 06:54 PM
RE: epoch Prime - salvomic - 01-06-2018 07:58 PM
RE: epoch Prime - salvomic - 01-06-2018, 08:45 PM
RE: epoch Prime - Dieter - 01-06-2018, 08:59 PM
RE: epoch Prime - salvomic - 01-06-2018, 09:01 PM
RE: epoch Prime - Dieter - 01-06-2018, 11:07 PM
RE: epoch Prime - StephenG1CMZ - 01-06-2018, 11:24 PM
RE: epoch Prime - salvomic - 01-07-2018, 09:26 AM
RE: epoch Prime - Dieter - 01-07-2018, 06:22 PM
RE: epoch Prime - salvomic - 01-07-2018, 06:28 PM



User(s) browsing this thread: 1 Guest(s)