home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Desklib:Time.h
- Author: Copyright © 1992, 1993, 1994 Jason Williams, Jason Howat
- Version: 1.02 (22 May 1994)
- Purpose: time handling
- */
-
-
- #ifndef __dl_time_h
- #define __dl_time_h
-
- #ifndef __dl_core_h
- #include "DeskLib:/Core.h"
- #endif
-
-
- /* Time_Monotonic
- * Veneer for the OS_ReadMonotonicTime SWI
- * Returns an integer representing the time since the computer was switched
- * on, in centiseconds.
- * Used with Wimp_PollIdle to poll every now and then, as in:
- * time = Time_Monotonic();
- * Wimp_PollIdle(mask, block, time + 100); // Pollidle for 1 sec (100cs)
- *
- * Can also be used to time things, i.e.
- * time = Time_Monotonic();
- * while (Time_Monotonic < time+100) |* wait *| ; // Wait for 1 second
- */
- extern int Time_Monotonic(void);
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- /* Time_ConvertDateAndTime -------------------------------------------------
- * Veneer for the OS_ConvertDateAndTime SWI.
- * Uses the format string to convert the given time to text.
- * Format codes: Field size:
- * CS Centiseconds 2
- * SE Seconds 2
- * MI Minutes 2
- * 12 Hours (12hr format) 2
- * 24 Hours (24hr format) 2
- * AM 'am' or 'pm' 2
- * PM ditto 2
- * WE Weekday varies
- * W3 Weekday (3 chars) 3
- * WN Weekday as number 1
- * DY Day of the month 2
- * ST 'st', 'nd', 'rd' or 'th' 2
- * MO Month name varies
- * M3 Month name (3 chars) 3
- * MN Month as number 2
- * CE Century 2
- * YR Year within century 2
- * WK Week number (Mon-Sun) 2
- * DN Day of year 3
- * 0 Insert an ASCII 0 byte 1
- * % Insert a '%' 1
- */
- extern os_error *Time_ConvertDateAndTime(char *fivebyteblock, char *buffer,
- int bufflen, char *format);
-
- /* Six time formats for ConvertDateAndTime are pre-defined for you:
- *
- * 1. Time_CTIME is equal to ctime() found in ANSI C <time.h> without
- * the automatic \n inserted
- *
- * 2. Time_STANDARD is the default setting found on most Arcs and not
- * the system variable <Sys$DateFormat>
- *
- * 3. Time_FANCYDATE is Sunday, 16th of January, 1994.
- *
- * 4. Time_SHORTTIME is 11:30pm
- *
- * 5. Time_LONGTIME is 11:30:12pm
- *
- * 6. Time_EUROTIME is 23:30:12
- */
-
- #define Time_CTIME "%W3 %M3 %DY %z24:%MI:%SE %CE%YR"
- #define Time_STANDARD "%24:%mi:%se %dy-%m3-%ce%yr"
- #define Time_FANCYDATE "%WE, %zDY%ST of %MO, %CE%YR"
- #define Time_SHORTTIME "%z12:%MI%pm"
- #define Time_LONGTIME "%z12:%MI:%SE%pm"
- #define Time_EUROTIME "%z24:%MI:%SE"
-
-
- /* Time_ConvertStandardDateAndTime -----------------------------------------
- * Veneer for the OS_ConvertStandardDateAndTime SWI.
- * Converts the given time into a string using the format string stored in
- * Sys$DateFormat.
- */
- extern os_error *Time_ConvertStandardDateAndTime(char *fivebyteblock,
- char *buffer, int bufflen);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-