To obtain the current calendar time there is the function
gmtime
. It has no arguments and returns the number of seconds
elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time
(UTC). For example:
param utc := gmtime();
GNU MathProg has no functions to convert UTC time returned by the
function gmtime
to local calendar times. Thus, if you
need to determine the current local calendar time, you have to add to
the UTC time returned the time offset from UTC expressed in seconds.
For example, the time in Berlin during the winter is one hour ahead of
UTC that corresponds to the time offset +1 hour = +3600 secs, so the
current winter calendar time in Berlin may be determined as follows:
param now := gmtime() + 3600;
Similarly, the summer time in Chicago (Central Daylight Time) is five hours behind UTC, so the corresponding current local calendar time may be determined as follows:
param now := gmtime() - 5 * 3600;
Note that the value returned by gmtime
is volatile, i.e.
being called several times this function may return different values.