This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warning: `%y' yields only last 2 digits of year


dewar@gnat.com (Robert Dewar) writes:

|> <<Which is still wrong since years can span more than just 1900 - 2099.
|> What's wrong with using %Y in the first place?
|> 
|> Andreas.
|> >>
|> 
|> You missed my point entirely, probably from not being aware of the Y2K
|> issues and solutions.

I am well aware of the Y2K problem.

|> A common technique for dealing with the Y2K problem, in cases where it is
|> impractical to modify data structures or databases, is to use what is usually
|> called windowing.
|> 
|> For instance an insurance company may know that it did not exist before
|> 1982, so any date in the range 82-99 is 1982-1999, and any date in the
|> range 00-81 is 2000-2081. This would of course be suitable only for
|> policy inception dates, not for client birthdates, but for the inception
|> date use, this can keep them going another 80 years, which may be plenty
|> (if for example they anticipate a complete system rewrite before 2080).
|> 
|> It was *specifically* for that common technique that I gave my example, and
|> the suggestion of using %Y is irrelevant.

Why?  You can do your calculation to convert a 2-digit year to a 4-digit
year and then just use %Y.  Do I miss anything?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]