$save nolist /* *============================================================================ * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE * * Permission to use for any purpose, modify, copy, and make enhancements * and derivative works of the software is granted if attribution is given to * R.M. Gillmore, dba the ACME Software Deli, as the author * * While the ACME Software Deli does not work for money, there is nonetheless * a significant amount of work involved. The ACME Software Deli maintains the * rights to all code written, though it may be used and distributed as long as * the following conditions are maintained. * * 1. The copyright statement at the top of each code block is maintained in * your distribution. * 2. You do not identify yourself as the ACME Software Deli * 3. Any changes made to the software are sent to the ACME Software Deli *============================================================================ */ /* * $Id: date.ext 1157 2025-05-05 00:35:39Z rmgillmore $ */ $if not DATE_EXT_INCLUDED $set ( DATE_EXT_INCLUDED ) declare time_t literally 'dword', DAYS_PER_WEEK literally '7'; /* * Member Type Meaning Range * tm_sec int seconds after the minute 0-61* * tm_min int minutes after the hour 0-59 * tm_hour int hours since midnight 0-23 * tm_mday int day of the month 1-31 * tm_mon int months since January 0-11 * tm_year int years since 1900 * tm_wday int days since Sunday 0-6 * tm_yday int days since January 1 0-365 * tm_isdst int Daylight Saving Time flag * * The Daylight Saving Time flag (tm_isdst) is greater than zero if * Daylight Saving Time is in effect, zero if Daylight Saving Time is not * in effect, and less than zero if the information is not available. * (NOT supported in our implementation) * * * tm_sec is generally 0-59. The extra range is to accommodate for leap * seconds in certain systems. (not likely supported in DOS) */ declare tmStruct literally 'structure ( tm_year word, tm_yday word, tm_isdst integer, tm_sec byte, tm_min byte, tm_hour byte, tm_mday byte, tm_mon byte, tm_wday byte )'; $if not clockTickSource waitForTicks: procedure ( numberTicks ) external; declare numberTicks word; end waitForTicks; $endif $if not dateSource currentTime: procedure ( tmStructPtr ) external; declare tmStructPtr pointer; /* to a tmStruct */ end currentTime; mktime: procedure ( tmStructPtr ) time_t external; declare tmStructPtr pointer; /* to a tmStruct */ end mktime; isLeapYear: procedure ( yearIn ) boolean external; declare yearIn word; end isLeapYear; dayOfWeek: procedure ( tmStructPtr ) byte external; declare tmStructPtr pointer; /* to a tmStruct */ end dayOfWeek; localtime: procedure ( timeIn, tmPtr ) external; declare timeIn time_t, tmPtr pointer; /* to a tmStruct */ end localtime; dos2time_t: procedure ( timeStamp, dateStamp ) time_t external; declare timeStamp word, dateStamp word; end dos2time_t; $endif $if not dateStringSource /* * The format string is akin to that in printf, and is defined as follows. It * contains any combination of regular characters and special format specifiers. * These format specifiers are replaced by the function to the corresponding values * to represent the time specified in the pointer to the tmStruct. They all begin * with a percentage (%) sign, and are: * * Specifier Replaced by Example * * %a Abbreviated weekday name Thu * %A Full weekday name Thursday * %b Abbreviated month name Aug * %B Full month name August * %c Date and time representation, equivalent to %a %b %e %X %Y Thu Aug 23 14:55:02 2001 * %C Year divided by 100 and truncated to integer (00-99) 20 * %d Day of the month, zero-padded (01-31) 23 * %D Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01 * %e Day of the month, space-padded ( 1-31) 23 * %F Short YYYY-MM-DD date, equivalent to %Y-%m-%d 2001-08-23 * %g Week-based year, last two digits (00-99) 01 * %G Week-based year 2001 * %H Hour in 24h format (00-23) 14 * %I Hour in 12h format (01-12) 02 * %j Day of the year (001-366) 235 * %m Month as a decimal number (01-12) 08 * %M Minute (00-59) 55 * %p AM or PM designation pm * %r 12-hour clock time, equivalent to %I:%M:%S %p 02:55:02 pm * %R 24-hour HH:MM time, equivalent to %H:%M 14:55 * %S Second (00-61) 02 * %w Weekday as a decimal number with Sunday as 0 (0-6) 4 * %x Date representation, equivalent to %m/%d/%y 08/23/01 * %X Time representation, equivalent to %R:%S 14:55:02 * %y Year, last two digits (00-99) 01 * %Y Year 2001 */ strftime: procedure ( tmStructPtr, formatString, returnString ) external; declare tmStructPtr pointer, tm based tmStructPtr tmStruct, formatString pointer, returnString pointer; end strftime; /* * a special case of strftime, using the %c format, resulting in a string * whose contents resemble these: * * Mon Jul 27 22:43:16 2009 * Fri Jun 7 10:22:22 2019 * */ asctime: procedure ( tmStructPtr, stringPtr ) external; declare tmStructPtr pointer, tm based tmStructPtr tmStruct, stringPtr pointer, userString based stringPtr (*) char; end asctime; $endif $endif $restore