Re: Euphoria and Year 2000

new topic     » goto parent     » topic index » view thread      » older message » newer message

Maurizio MORONI writes:
> Since in my job I'm in charge of create some test cases
> related to Y2K , I wonder if Euphoria has any problem
> respect to this. I mean Euphoria interpreter or
> programs written in Euphoria.

There are two library routines that return dates:
dir() and date().

dir() returns full 4-digit file dates.
date() returns "the number of years since 1900",
*not* just the last 2 digits of the year. In the year 2000
date() will return 100 for the year, *not* 0. You should
always add 1900 to get the year.
See comments in LIBRARY.DOC / date().

My machine booted-up one time with the year set to
2098 rather than 1998. The DOS DIR command
showed only the last 2 digits of the year so I went
along for a few days without detecting any problem,
except that one application (not written in Euphoria)
kept crashing.

Eventually I ran a Euphoria program (top.ex from
"extra stuff from RDS" on the Archive page). It showed
the year on the most recently updated files
on my system as "2098". This
surprised me and I eventually figured out what had
happened. After correcting the system date back to 1998
the application started working again (a program to
upload files to CompuServe).

You can (stupidly) write a program in any language that will
only use the last 2 digits of the year, but at least
in Euphoria you can retrieve the full year and avoid the
year 2000 problem fairly easily.

As a test, you can set the date on your system temporarily
to the year 2000. Then create "junk.ex" in an empty directory
(it will have a file date of year 2000) and run:

-- junk.ex:
include file.e
puts(1, "dir is:\n")
? dir(".")
puts(1, "date is:\n")
? date()

Do it in an empty directory so the output from dir() will
be small. You should see "2000" in the dir() output and
"100" in the date() output.

Regards,
     Rob Craig
     Rapid Deployment Software

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu