[EMAIL PROTECTED] wrote:
> I think you may wish to check this further.
> 
>> current-time: now/time
> 
>> file-name: rejoin [
>  now/year
>  now/month
>  now/day
>  current-time/hour
>  current-time/minute
>  current-time/second
>  ]
> 
>> complete-file-name: rejoin [{%} file-name {.html}]
> 
> When I was looking at something similar, I hit a problem
> because the integer returned is of course not 0-padded on the left.
> So, is it (2000116) November 6th or is it January 16th??
> Statistically it may be unlikely to cause a problem,
> but if it could happen even once and that would mess you
> up bad, then you better pre-pad the month and day with 0 when necessary.

Try this:

twodig: func [digit digstr/local][
 digstr: to-string digit
 either (length? digstr) = 1
 [return join "0" digstr]
 [return digstr]
]

n: now
complete-file-name: rejoin [
 n/year
 twodig n/month
 twodig n/day
 twodig n/time/hour
 twodig n/time/minute
 twodig n/time/second
]

I'd recommend using only one "now" statement, since theoretically it's
possible that we call the first "now" at say 23:59:59.99 at 31 of December
2000. Then maybe the first statement takes some fraction of a second, so
the second "now" gets the date-time of 00:00:00 at 1 Jannuary 2001. Then it
rejoins this to.. 20000101000000 when it should have been 20001231235959 or
20010101000000 - one year wrong. Oops.

-- 
  /Johan R�nnblom, Team Amiga

In a recent survey, it was found that only 16% of people are normal.


Reply via email to