ret_time.u4.v = convert_seconds_c(source_time.u4.v, convert_type.i4.v)
This function converts from a TIME in seconds in one format to
a TIME in seconds in another format.
source_time source TIME in seconds
convert_type conversion type
(DATE_UTC_CTIME_TO_CLINKS -> convert UTC ctime to clinks,
DATE_UTC_CTIME_TO_LOCAL_CTIME -> convert UTC ctime to local ctime,
DATE_LOCAL_CTIME_TO_CLINKS -> convert local ctime to clinks,
DATE_LOCAL_CTIME_TO_UTC_CTIME -> convert local ctime to UTC ctime,
DATE_CLINKS_TO_UTC_CTIME -> convert clinks to UTC ctime,
DATE_CLINKS_TO_LOCAL_CTIME -> convert clinks to local ctime,
DATE_LABVIEW_TO_CLINKS -> convert LabView TIME to clinks,
DATE_LABVIEW_TO_LOCAL_CTIME -> convert LabView TIME to local ctime,
DATE_LABVIEW_TO_UTC_CTIME -> convert LabView TIME to UTC ctime
DATE_CLINKS_TO_LABVIEW -> convert clinks to LabView TIME,
DATE_LOCAL_CTIME_TO_LABVIEW -> convert local ctime to LabView TIME,
DATE_UTC_CTIME_TO_LABVIEW -> convert UTC ctime to LabView TIME),
There are two types of ctimes in the control system - local and UTC.
Local ctimes are historical and reflect the semantics of the now
retired VAX/VMS machines. UTC ctimes reflect the semantics of the
Linux machines which replaced the VAX/VMS machines.
1. Have their t=0 moment at 1/1/1970 midnight CST
2. Jump forward by 3601 seconds at the transistion to DST and
Jump backwards by 3599 seconds at the transition from DST.
3. Are not recommend for new use because of the above non-linear
1. Have their t=0 moment at 1/1/1970 midnight UTC
2. Increase by 1 each second even at transistions to/from DST
Clinks are indentical to UTC ctimes except that their t=0 moment is
at 1/1/1972 midnight CST. So one has
UTC ctime = clinks + 2 years and 6 hours worth of seconds.
THIS ROUTINE HAS SOME CASES WHERE IT CAN NEITHER DO THE RIGHT THING NOR REPORT AN
ERROR TO THE USER. IT ALSO HAS CASES WERE IT MUST ARBITRARILY RESOLVE AN AMBIGUITY.
1. If the converted into TIME system has a later t=0 moment than the converted
from TIME system then a postive input would convert to a negative value in the
converted into system. Since the output is unsigned the routine has no way of
actually returning this negative value and one will instead get a large
2. Some local ctime values are impossible because of the Spring transistion to
DST. This routine has no way to report such an input as being in error. What
converted value it will give you is undefined. Some local ctime values
happen twice because of the Fall transistion from DST. For these cases the
routine should arbitarily pick one of the two possible values, but which one is
These cases are presumably rare because they are associated with times before the
lab was in serious operation or are during the middle of the night. One can
avoid the middle of the night issues entirely by not using local ctime, which is
a leftover from the VAX/VMS era.
This function returns status values as follows:
requested date in seconds
This function requires the following include files:
clinks_now, clinks_to_date, clinks_to_day_of_week_c, date_to_clinks,
get_date_clinks, convert_compare_date_to_clinks, db_date_to_clinks,
slash_date_to_clinks, traditional_date_to_clinks, db_date_to_date_c,
int convert_type = DATE_UTC_CTIME_TO_CLINKS;
unsigned int ret_time;
unsigned int source_time = 842889627;
ret_time = convert_seconds_c(source_time);