Time utilities: programs in MUMPS for calculating intervals of time and for timing events

There are several routines available to calculate time from the S counter.and the date from the D counter and 2]; two are provided in the Appendix. Times may be expressed in 24-hour clock notation (for example 1850 h) or in a.m./p.m. (for example 6.50 p.m.) style. Dates can be expressed in a variety of formats to suit local requirements (or prejudices) such as 2 Jan 1985, Jan 2 1985, 020185, 02/01/85, 010285, 850102 and so on. Clearly this wide flexibility in final style, the availability ofthe day and second counters and the general ease ofuse of the MUMPS language anyway makes it very easy to create programs for solving problems involving dates or times.


Introduction
The MUMPS language possesses a special function, HOROLOG (or H), which allows easy manipulation of dates and times [1 and 2]. HOROLOG returns a string containing two numbers, D and S. The day counter, D, starts in standard MUMPS from the first day of January 1841; the second counter, S, starts afresh at midnight on each day and counts elapsed time in seconds.
There are several routines available to calculate time from the S counter.and the date from the D counter and 2]; two are provided in the Appendix. Times may be expressed in 24-hour clock notation (for example 1850 h) or in a.m./p.m. (for example 6.50 p.m.) style. Dates can be expressed in a variety of formats to suit local requirements (or prejudices) such as 2 Jan 1985, Jan 2 1985, 020185, 02/01/85, 010285, 850102 and so on. Clearly this wide flexibility in final style, the availability of the day and second counters and the general ease ofuse of the MUMPS language anyway makes it very easy to create programs for solving problems involving dates or times.
A set of simple programs are described in this paper; the programs are used daily, in a hospital department of clinical biochemistry, for event timing and calculations involving intervals and days, or hours, of patient stay.

Materials and methods
The University Hospital laboratory computer system is a 32-bit Data General Eclipse MV/6000 with megabyte of core memory (Data General    It is a tedious and error-prone step to enter the entire time and date for each subsequent event. A series of defaults has therefore been inserted in the program that will allow entry only of the new elements of the date. Thus, if only the time is different from the initial event it is only necessary to press <ENTER> after entry of the time. If both the time and the day are different, then after these have been entered the program will use the previous (i.e. initial event) month and year setting. This default has proved to be extremely useful. Thus when timing samples from the onset of chest pain taken from a patient with a myocardial infarction [4], four or five specimens have often been found with the same date so that this default considerably reduces the amount of data to be keyed in. This routine is most commonly used when all patient data is available. The program is listed in table 2. When patients are being studied over longer periods, with intermittent entry of data, the next routine to be described is more suitable.

Set time calculator
This routine performs the same function as the Elapsed Time Calculator except that a file is opened for each patient, together with the date and time of the initial event. This type of routine is useful when following a patient, or experimental subject, over weeks, months or even years. For example, in a study of serum enzyme changes in heart transplant patients [5], some patients were followed for over two years.
The routine has five components-Input, Edit Table 3. The program for the Set Time routine. This program performs the same functions as the Elapsed Time program but allows for the creation of a file.for each subject so that calculations can be made at intervals during a study.

Discussion
Calculations involving times or dates are common in medical and biological research. However, these calculations are awkward and very prone to error-because of the different scaling of minutes in the hour, hours in.the day and days in the month or year. The MUMPS language is, however, well adapted to handle these scaling differences and the programs that we describe here have been used, with benefit, for a variety of purposes by the staff of this department.