A COMPUTER SYSTEM, ARRANGEMENT AND METHOD FOR HANDLING CENTURY INFORMATION WITHIN A DATE REPRESENTATION
Technical field of the invention
The present invention relates to a computer system for processing, and an arrangement and method for adapting a computer system to process, date representations having a format indicating the century of a represented date.
Technical Background and Prior Art In many computer systems, in particular older computer systems, dates are represented by six characters. The representation used indicates the year by two digits corresponding to the last two numbers of the year in question, the month by two digits corresponding to the month (1 - 12) in question, and the day by two digits corresponding to the day of the month (1 - 31).
The use of only six characters was employed in order to save memory capacity, which was expensive at the time. Furthermore, it was not expected that these old computer systems was going to survive into the next century, i.e. the twenty-first century.
The standard way of representing a date with six characters was, and in many cases still are, to represent the year with two digits in the range 00 - 99, the month with another two digits in the range 01 - 12 and the day with yet another two digits in the range 01 - 31. The order of these digits can be varied in a number of ways to produce a number of standard formats, such as YY/MM/DD, MM/DD/YY or DD/MM/YY, where Y is a year digit, M a month digit and D a day digit. The representation is
thus well suited to represent any date in a certain century, for example the 20:th.
These formats will create problems in many computer systems when, for example, dates are to be sorted or merely compared, since there is no way to identify the difference between different centuries.
A reprogramming of the whole system to use an eight character format including four, instead of two, year digits is time consuming and expensive. One proposed solution is to change the date format into the representation CYYDDD, where C denotes the century, YY the year, and DDD the day as a number from 1 - 365 or 366. This proposed method will only solve a part of the problem. A problem which will remain is that most of the computer systems are set to employ one of the standard formats YY/MM/DD, MM/DD/YY or DD/MM/YY and used in that form for different calculations, such as determining the month. Moreover, the standard formats are better suited for display to a user, for whom it will be easier to use the date information, since the day and the month are displayed explicitly.
US, 5 668 989, discloses a method in which the first digit of the two character year group is treated as a hexadecimal, thereby enabling representation of years in a 160 year time span, instead of the 100 year time span available from treatment as a decimal.
US, 5 644 762, relates to a method of how to treat the year characters by using the normally unused ranges of the two eight-bit bytes representing the year.
Objects of the invention
It is an object of the present invention to adapt an existing computer system to the twenty-first century in a way that minimises the amount of reprogramming . Another object is to adapt an existing system in such a way that the system can interact with its
environment without having to rebuild its existing interfaces which use a six character date format.
Another object is to adapt an existing system in such a way that the system can interact with its environment with an interface using an eight character date format including century information, rather than the old six character date format without century information.
Yet another object is to adapt an existing system to be able to interpret a six character date format without century information as a date referring to a certain century and to continue to process this date taking into account that it refers to a certain century.
Another object is to realise a new system having the same abilities as the above mentioned adapted existing system.
Summary of the invention
The above mentioned objects are achieved by the present invention as set forth by the accompanying claims .
The inventive idea of the present invention is to include, in a date representation, information referring to the century of a date by merging this century information with any other information not referring to the year of said date. This basic idea forms the foundation for a number of different aspects of the present invention.
According to a first aspect of the invention, the above mentioned objects are achieved by a computer system for processing date representations in which a date is represented by a character format, said format having at least one set of characters representing a year and one further set of characters, wherein century information indicative of the century of said date is incorporated in said further set of characters.
Thus, this gives the advantage that century information easily can be incorporated in a date representation without having to extend the number of characters of the format of the date representation for this purpose.
The century information can be incorporated in any characters not representing a year of the date, regardless of the number of characters in the date representation format. In a four character format, having two characters representing a year and two characters representing a month, the information is included in the month character. In a six or eight character format, having two or four characters representing a year, two characters representing a month and two characters representing a day, the information is either included in the month characters, the day characters, or a combination thereof. An advantage of having century information incorporated in an eight character format already having the century of the date in its four character representing a year, is that this in some cases enhances the security of the system.
According to one embodiment of the invention, said character format is formed as a six character format and said century information is expressed, at least for one century, as an offset included in the two characters representing the month. These offsets may be chosen in a number of various way. Two different offsets can indicate two different centuries, for example the offset 0 may indicate the twentieth century and the offset 20 the twenty-first century, giving the value of the month characters a range of 1-12 and 21-32, respectively. It is also possible to have offsets for other additional centuries and/or other offset values.
In another embodiment said century information is expressed in a six character format as an offset included in the two characters representing a the day. Also here, a number of different offsets for different centuries can
be used, for example 0 for the twentieth century and 40 for the twenty-first century.
This way of incorporating century information is particularly advantageous in older computer systems which operate with date representations having a format normally not including such information. In these older systems the format can be kept intact and there is only a need to adjust the system to accept the new intervals of the date characters. According to a second aspect of the invention, said objects are achieved by an arrangement for adapting a computer system to handle century information when processing six character format date representations, wherein means are incorporated for conversion between a date representation with a predetermined format including year and century information, in particular an eight character format having four characters representing a year, two characters representing a month and two characters representing a day and a date representation with a six character format having two characters representing a year, two characters representing a month and two characters representing a day, said two characters representing a month or said two characters representing a day including information indicative of the century.
According to an embodiment of the invention said means for conversion consist of software subroutines. In another embodiment the means consist of hardware circuits. These circuits may be situated in a computer, in a keyboard, or between a keyboard and a computer.
According to a third aspect of the invention, said objects are achieved by a method for adapting a computer system to handle century information when processing six character format date representations, comprising the step of converting between a date representation with a predetermined format including year and century information, in particular an eight character format
having four characters representing a year, two characters representing a month and two characters representing a day and a date representation with a six character format having two characters representing a year, two characters representing a month and two characters representing a day, said two characters representing a month or said two characters representing a day including information indicative of the century. These latter two aspects mean that the system is able to accept, and to present, formats of date representations from/to user terminals, other computer systems or storage media, having additional explicit century information, while still maintaining an internal six character format date representation incorporating century information. The two embodiments described in connection with the first aspect are also applicable with respect to these two aspects. It should be noted that the system alternatively communicates with its environment using solely a date representation where the century information has been merged with any information not referring to the year of a date, in which case the means for conversion is obsolete.
According to a fourth aspect of the invention, said objects are achieved by a method for converting date representations stored in a storage media from a first six character format without century information to a second six character format with explicit century information, both of which formats have two characters representing a year, two characters representing a moth and two characters representing a day, comprising the steps of: reading a date represented with said first format from said storage media; deciding whether the two characters representing a year of said date belongs to a lower range or an upper range;
representing said date in said second format by incorporating information relating to the twenty-first century when said date belongs to said lower range, or incorporating information relating to the twentieth century when said date belongs to said upper range; and storing said date in said storage media using said second format.
Dates are here read from, and stored in, a storage media. However, the dates are alternatively accepted from and/or presented to any other I/O-interface, such as a user terminal or a communication port to another computer system. With this method the system can interpret what century a date refers to even though it is has a representation which does not include any century information. A new representation of the date including century information is then used in the further processing of the date. For any further interaction with any I/O-device the new representation is used, either directly or by converting it a standard format having century information.
In the present invention it is possible to convert between different date format representations in a numerous ways. One way is to have software subroutines performing the conversions, another way is to have a predefined look-up table, yet another way is to implement the conversions by means of hardware circuits. Yet another way is to incorporate these conversions in the compiler in such a way that the conversions, where applicable, automatically are performed at compilation time.
Further aspects and characteristics of the present invention will be apparent from the following description of a number of preferred embodiments of the invention.
The novel format for date representations described in this application, that is a format where information of the century of a date has been merged with any other
information not referring to the year of said date, will from hereon be called the Roman format.
Brief description of the drawings Figs, la - lc illustrate date representations having a six character format in an exemplified standardised way;
Figs. 2a - 2c illustrate date representations having an eight character format in an exemplified standardised way;
Figs. 3a - 3d illustrate date representations having Roman formats in accordance with two different embodiments of the invention;
Fig. 4a is a flow chart illustrating a conversion of a date from a standard format to a Roman format in accordance with an embodiment of the invention;
Fig. 4b is a flow chart illustrating a conversion of a date from a Roman format to a standard format in accordance with an embodiment of the invention; Fig. 5 is a flow chart illustrating a further embodiment of the present invention;
Figs. 6 and 7 schematically show two different hardware configurations in accordance with two different embodiments of the invention; Fig. 8 is a flow chart which shows yet another embodiment of the invention;
Figs. 9a and 9b are flow charts illustrating two exemplifying ways of how to utilise the invention.
Detailed description of preferred embodiments
In figure la an exemplified standard date format is shown. The format has six characters for representing a date, where the two character group Y2Yι represents the year with a value in the range 0 - 99, the two character group 2Mχ represents the month with a value in the range 1 - 12 and the two character group D2Dι represents the day with a value in the range 1 - 31. With this format any
date within a certain century can be represented. The order of these two character groups can be varied to produce a number of different standard formats for representing a date. Fig. lb and fig. lc shows two exemplifying dates, 4:th of March 1997 and 4:th of March 2001, using the format from fig. la. Since 01 is smaller than 97, 4 : th of March 2001 will be considered as an earlier date than 4:th of March 1997. Another exemplified standard date format is shown in fig. 2a. This is an eight character format, with a four character group Y4Y3Y2Yχ representing the year. The format can distinguish between different centuries and a comparison between the two exemplifying dates 4 : th of March 1997 and 4 : th of March 2001, shown in fig. 2b and fig. 2c, respectively, will, based upon the four character group year representations, give a correct result .
With reference to figs. 3a - 3d the inventive novel format, called the Roman format, will be explained. A way of representing a date in Roman format according to one embodiment of the invention is shown in fig. 3a. Here, the Roman format uses six characters to represent a date, where the two character group Y2Yι represents the year, the two character group M2MX represents the month and the two character group D2Dχ represents the day. The value of the year group will be in the range 0 - 99 representing the year of a century.
In fig. 3b - 3d an offset value 0 has been chosen to represent the twentieth century, thus the date in fig. 3b represents 4 : th of March 1997. The twenty-first century is then represented either by an offset for the month group value, according to one embodiment of the invention, or by an offset for the day group value, according to another embodiment of the invention. In fig. 3c the twenty-first century is represented by an offset value 20 for the month group, giving a range for the
value of the month group of 21 - 32 (January - December) . Alternatively, in fig. 3d the twenty-first century is represented by an offset value 40 for the day group, giving a range for the value of the day group of 41 - 71 (day 1 - day 31 of a month) . Thus, the two variants of the Roman format depicted in figs. 3c and 3d both represents 4:th of March in the year 2001.
Figs. 4a and 4b are flow charts of two other embodiments of the present invention. The flow charts in figs. 4a and 4b illustrate the conversion from an eight character standard format to a six character Roman format and from a six character Roman format to an eight character standard format, respectively. The notations used in these flow charts are as follows. The values of the standard format month character group M2Mι and day character group D2Dχ are in the flow chart denoted sf_month_value and sf_day_ alue, respectively. The value of the standard format year group Y4Y3Y2Yι is split into two parts, the value of the two least significant characters Y2Yι denoted sf_year_lsc_value and the value of the two most significant characters Y4Y3 denoted εf__year__msc_value . The values of the year character group Y2Yι, month character group M2Mι and day character group D2D of the Roman format are denoted rf_year_val ue , rf_month_value and rf_day_value, respectively.
Assume that the six character Roman format is chosen in such a way that a date of the twenty-first century is represented by an offset with the value 20 included in the value of the month character group M2Mχ and that said group has an offset with the value 0 for a date of the twentieth century. With reference to fig. 4a, the conversion from standard format to Roman format will then comprise testing the condition sf_year_msc_val ue = 20. If this is true the standard format indicates a date of the twenty-first century and the offset value 20 will be added to the sf__month_value resulting in a rf mon th val ue . If the condition is not fulfilled the
standard format indicates a date of the twentieth century and there will be no offset added, but the rf_mon th_val ue will be equal to the sf__month_value . From the flow chart in fig. 4a it is easily seen that the standard format dates 2001-03-04 and 1997-03-04 will be converted to the six character Roman format dates 01-23-04 and 97-03-04, respectively. With reference to fig. 4b, the conversion from Roman format to standard format will comprise testing the condition rf_month_value > 20. If this is true the Roman format indicates a date of the twenty- first century and the offset value 20 will be subtracted from the rf_month_value resulting in a sf_month__value, and the sf_year_msc_yalue will be set to 20, which is the value of the two most significant characters of a four character year of the twenty-first century. If the condition is not fulfilled the Roman format indicates a date of the twentieth century and there will be no offset subtracted, but the sf_month__value will be equal to the rf_month_value, also the s _year_irnsc_value will be set to 19 which is the value of the two most significant characters of a four character year of the twentieth century. From the flow chart in fig. 4b it is easily seen that the Roman format dates 01-23-04 and 97-03-04 will be converted to the standard format dates 2001-03-04 and 1997-03-04, respectively.
To translate these flow charts into some kind of software subroutines, with executable code in any computer language, is an easy task for a person skilled in the art. Moreover, it would be an easy task for a manufacturer of a code compiler to incorporate these conversions in the compiler. That is, a date defined as a standard/Roman format by a programmer would automatically be converted to a Roman/standard format by the compiler at compilation time. However, these conversions may also be implemented by means of hardware circuits.
Fig. 5 is a flow chart illustrating another embodiment of the present invention. Here a computer
system uses a Roman format for the relevant processing of date representations. A standard format date is inputted to the computer system via a terminal connected to the computer system, or via an Input/Output ( I/O) -device connected to another computer system, or from a storage media. The standard format is converted to a Roman format, for example m accordance with the description referring to fig. 4a, m order for the computer system to be able to process the date representation. The Roman format date is processed by the system and when there is a need to output a date from the system the representation of this date is converted from the Roman format to the standard format. After this conversion, for example in accordance with the description referring to fig. 4b, the date is outputted m a standard format to a terminal, I/O-device or storage media.
In fig. 6 a hardware configuration for a system in accordance with the present invention is shown. The configuration comprises a computer, an I/O-device, a user terminal and a storage media. The storage media is preferably configured to hold a database. The conversions, where applicable, between standard and Roman format are here either implemented in software or being an integral part of a compiler, as previously described with reference to figs. 4a and 4b.
Fig. 7 shows another hardware configuration for a system m accordance with the present invention. It shows an alternative hardware configuration comprising a computer, an I/O-device, a user terminal, a storage media, and also converting means. Each one of the converting means forms an arrangement for converting between standard and Roman format, for example m accordance with the steps or methods described with reference to figs. 4a and 4b. Hence, the conversions are not implemented in software, but preferably by means of hardware circuits.
Fig. 8 is a flow chart illustrating another embodiment in accordance with the invention. This embodiment is applicable in case a computer system adapted to handle Roman format date representations is to be able to handle dates of the twenty-first century already stored in, or being inputted to, the system in a six character standard format. The six character standard format date is read from a storage media or from another kind of I/O-interface, such as from a user terminal or from a communication port connected to another computer system. The notations used in this flow chart are the same as those previously used in figs. 4a and 4b, except for that the six character standard format only has one value for the group of characters representing a year, namely sf_year_value representing the two character year value Y2Yι, as described with reference to figs, la - lc. A kind of windowing-technique is then used to decide which century a date refers to. Here this means that the two character year value Y2Yι undergoes a conditional test. If the value is in the range 1 - 49, the year is considered to refer to the twenty-first century and an offset value 20 will be added to the sf_month_value resulting in an rf_month_value . If the year value is in the range 50 - 99, the year is considered to refer to the twentieth century and no offset will be added, but the rf_mon th_ value will be equal to the sf_month_value . This means that the six character standard format dates of fig. lb and lc will be converted to the six character Roman format dates of fig. 3b and 3c, respectively. The Roman format date is then written to a storage media, for example a media holding a database. However, the date may alternatively be presented to another I/O-interface, such as a user terminal or a communication port to another computer system. In figs. 9a and 9b another two exemplifying ways of how to utilise the invention are shown. In fig. 9a a software program or routine receives a date in a Roman
format. The date is then converted from the Roman format to a standard format. In this way the standard library functions accepting and processing dates of a standard format can be utilised by the program. A function call result not being in the form of a standard date format is immediately returned by the routine. However, if the function call result is in the form of a standard date format, the date is converted into a Roman format before the result is returned by the routine. Alternatively, the Roman format date is accepted from, and the function call result is presented to, an I/O-interface, whereby the conversions is either realised with software or by means of hardware circuits.
In fig 9b a Roman format date is accepted from an I/O-interface after which it is processed. The program has access to a library with functions accepting and processing dates of a Roman format. Hence, no conversion of date formats is necessary, neither before a function call, nor before a function call result is presented to an I/O-interface.
It is obvious that the above described embodiments and examples can be combined in a number of various ways without falling outside the scope of the appended claims. Any date processing may be performed by a software subroutine, which means that the date format, standard or Roman, is transferred to the routine during the call to the routine. Alternatively, the date processing may be regarded as performed by the system as a hole, in which case the date is transferred via some kind of I/O- interface, for example, connected to a user terminal, forming a port to another system, or being connected to a storage media of some kind. The conversions between standard and Roman format is either performed by software routines, a compiler or, where applicable, by hardware circuits.