Menu

#36 year out of range error

open
None
8
2004-08-27
2004-08-27
No

When trying to create a new quiz I get an error "Year
out of range (must be >= 2000): 1970".
This is on a Windows 2000 machine.

Discussion

  • Gustav W Delius

    Gustav W Delius - 2004-08-27

    Logged In: YES
    user_id=737246

    ..and by the way: I am using Maple 8

     
  • Greg Gamble

    Greg Gamble - 2004-08-27

    Logged In: YES
    user_id=766524

    This message is generated by `Date/DaysSince1Jan2000` in
    Date.mpl
    when called with a year < 2000. The only way I can see that
    the error
    message could be generated is if your computer's date was
    set to before
    the year 2000. Is that the case? ... maybe to avoid software
    license expiries
    or something.

    Regards,
    Greg

     
  • Gustav W Delius

    Gustav W Delius - 2004-08-27

    Logged In: YES
    user_id=737246

    The date that Windows displays is the correct one. How does
    AiM get the date from my computer?

     
  • Greg Gamble

    Greg Gamble - 2004-08-28

    Logged In: YES
    user_id=766524

    `Date/CurrentRawDate`() is used. This calls an internal
    Maple function: iolib(25)
    which apparently (couldn't find any documentation) returns
    the number of
    seconds since 00:00:00, Jan 1, 1970 ... it agrees with the
    UNIX date +"%s"
    A moment ago this function gave: 1093688092 ... for me.
    Maybe you could check that your Maple responds with a
    similarly sized number
    when you give it: iolib(25);

    Regards,
    Greg

     
  • Gustav W Delius

    Gustav W Delius - 2004-08-28

    Logged In: YES
    user_id=737246

    I found the bug: in the Date constructor the 'SetTimeZone'
    method is called before the 'Raw' field is set.
    The 'SetTimeZone' method therefore assumes that the raw
    time is 0, which leads to the "Year out of range" error.

    While I managed to find the bug I don't feel up to the task of
    fixing it properly. I'll leave that to Greg.

     
  • Greg Gamble

    Greg Gamble - 2004-08-29

    Logged In: YES
    user_id=766524

    I finally discovered how it was that I was not experiencing the
    error. Essentially, it came down to our lack of summer time.
    In filling in some of the entries the Date constructor uses a
    default time (0 as you observed, which translates to 1 January,
    1970), so that the `Date/DaysSince1Jan2000` function I'd
    introduced needed to actually be `Date/DaysSince1Jan1970`.
    I've replaced the former function by the latter now, and that
    bug should be gone now. I'll do some more thorough testing
    tomorrow, but I'm confident everything is working properly now.
    Sorry, it was my goof after all.

    Regards,
    Greg

     

Log in to post a comment.