Is it bad practice to create software that does not work on a historical date?

Here is what made me think.

I have a function that automatically generates the next logical element number. Part of this item number includes the year the item number was created. We are now this year 2010, so the most significant part of the date (for the purpose of my position number) is “10” and is two long characters. If my program would have to be executed in 2009, the current code, I would get a bad subject number, because my system expects a two-digit date (10) not one (9).

My question is not at all about my specific situation, and if it is a good idea to do such string manipulations or not :), but more according to the principle indicated in my title. Is it a bad idea to write software that will not function properly if it works in history? You faced a similar situation and what route did you take and why?

+3
source share
5 answers

That's right: "My program will not work with historical data." In your particular case, “historical data” is material until January 1, 2010. I strongly disagree with those who say that it is generally a bad idea to place such restrictions on your code.

. UNIX time_t, , 68 . , time_t, 1901-12-13 2030-01-19. . , - , - .

. , , - , . , 1- , , , . , .

, , " Y2K" , , . , 4- . , 10 000 ? Y10K! - , .

. , , , .

+5

, y2k? , , .

+3

, .

-, * - - . ?

, , , - 90 , - , . , '01.

, .

* , , .

+1

. , , , , 1970 (Unix epoc). . , , , - / .

, , , 2 ^ 25 , -epoc , , , "" , , 2- .

2226. - , , , (.. , , -).

, 2009 "09", ? , ; -)

+1

, , . - , , , . , , -, , , . , ; , .

+1

Source: https://habr.com/ru/post/1775706/


All Articles