Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: /precise problem

From: rchristiansen:pop:isdfa:sei-it at: 28-Dec-2000 14:48

OK. It appears the /precise refinement when it rolls the thousandths- of-a-second from 999 back to 0 that it does NOT return zero nor none but some other value.
> > This appears to work until the thousandths-of-a-second value reaches > either 1,000 or zero (not sure how REBOL is handling this, which is where > the problem lies, I believe.) > > Probably goes from 999 and roll around to 0, or none. > > > ** Script Error: Out of range or past end > > ** Where: time-in-digits > > ** Near: partial-seconds: second split-seconds > > while [(length? whole-seconds) < 2] > > Probably 'whole-seconds is 'none ?
20001228143859967 20001228143859977 20001228143859987 20001228143859987 20001228143859997 ** Script Error: Out of range or past end ** Where: time-in-digits ** Near: partial-seconds: second split-seconds
>> print split-seconds
7E-3
>>
Please forgive my ignorance, but what does the 7E-3 notation stand for in mathematical terms? (I haven't had a math class since high school.) And why is this value showing up? The word 'split-seconds is supposed to return two items in a series, both of which are string! datatypes. My new time-in-digits function follows. It includes some error checking in an attempt to harness the /precise refinement. Thanks -Ryan time-in-digits: func [ "Convert the date and time from 'now' into a string of digits." sun-dial [date!] "The current date and time from 'now'" ][ year: to-string sun-dial/year month: to-string sun-dial/month if (length? month) < 2 [insert month "0"] day: to-string sun-dial/day if (length? day) < 2 [insert day "0"] current-time: sun-dial/time hour: to-string current-time/hour if (length? hour) < 2 [insert hour "0"] minutes: to-string current-time/minute if (length? minutes) < 2 [insert minutes "0"] seconds: to-string current-time/second seconds-rounded: make integer! current-time/second either current-time/second = seconds-rounded [ whole-seconds: seconds partial-seconds: "000" ][ split-seconds: parse/all seconds "." whole-seconds: first split-seconds partial-seconds: second split-seconds ] while [(length? whole-seconds) < 2][insert whole-seconds "0"] while [(length? partial-seconds) < 3][append partial-seconds "0"] rejoin [year month day hour minutes whole-seconds partial-seconds] ]