|
Post by clayharley on Mar 26, 2008 21:57:45 GMT -5
Hi,
A newbie here, and I see a lot of potential in Run BASIC. I'm checking out a few things in the 'Write Your Own' tab on the main runbasic.com page. (Haven't bought a copy, yet.)
I ran the following code:
print time$() print 60 * 60 * 24 print time$("seconds") print time$("milliseconds") print using("###,###", 60 * 60 * 24) print using("##,###,###,###,###", time$("seconds"))
and got the following results -
9:06:58 pm 86400 3384036418259 3384036418259 86,400 3,384,036,418,259
Per the Wiki > Building Blocks and Help file (v.0.5), the Time$() function with the 'Optional Modifier' "seconds" or "milliseconds" should return the number of seconds or milliseconds respectively since the last midnight. The actual number of seconds since the last midnight can be no more than: 86,400 (60 * 60 * 24).
A little bit of trial and error calculations showed me that the 3.38 trillion number being returned from both functions, is the number of MILLISECONDS since Jan. 1, 1901. Those two time$() functions are working like the print date$("days") function.
Is this the same behavior seen in bought and installed versions?
Thanks,
-clayharley
|
|
|
Post by StefanPendl on Mar 26, 2008 22:36:02 GMT -5
Here is the output of RBP 1.01 beta1 on a German localization:
Don't know, but Carl might have changed the base from last midnight to midnight of 1.1.1901 to get rid of the problems, when programs run across midnight.
|
|
|
Post by clayharley on Mar 27, 2008 23:17:07 GMT -5
I would think that the Time$() function with the "seconds" parameter would need to be somewhat "standard" because - A) there is most likely a similar function in other versions of BASIC, and - B) the documentation already specifies what the function is supposed to return.
I can see a need for a 'close' reference point (i.e., last midnight), and a 'distant' reference point (e.g., Jan. 1 of current year or Jan. 1 of 2000 [current century]). I would like to see an optional second parameter (e.g. Time$("secs","yr") ) that would switch the value returned from last midnight to the Jan. 1 value of either the year or the century, in case the developer knows that a more distant reference point would be needed for the application.
Either the standard behavior or the optional behavior could be used, as needed, without 'breaking' current programs.
|
|