]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-libs-pim/TimeDate.def
Merge modula-2 front end onto gcc.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs-pim / TimeDate.def
1 (* TimeDate.def provides a Logitech-3.0 compatible library module.
2
3 Copyright (C) 2005-2021 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
26
27 DEFINITION MODULE TimeDate ;
28
29 (*
30 Legacy compatibility - you are advised to use cleaner
31 designed modules based on 'man 3 strtime'
32 and friends for new projects as the day value here is ugly.
33 [it was mapped onto MSDOS pre 2000].
34 *)
35
36 EXPORT QUALIFIED Time, GetTime, SetTime, CompareTime, TimeToZero,
37 TimeToString ;
38
39 TYPE
40 (*
41 day holds: bits 0..4 = day of month (1..31)
42 5..8 = month of year (1..12)
43 9.. = year - 1900
44 minute holds: hours * 60 + minutes
45 millisec holds: seconds * 1000 + millisec
46 which is reset to 0 every minute
47 *)
48
49 Time = RECORD
50 day, minute, millisec: CARDINAL ;
51 END ;
52
53
54 (*
55 GetTime - returns the current date and time.
56 *)
57
58 PROCEDURE GetTime (VAR curTime: Time) ;
59
60
61 (*
62 SetTime - does nothing, but provides compatibility with
63 the Logitech-3.0 library.
64 *)
65
66 PROCEDURE SetTime (curTime: Time) ;
67
68
69 (*
70 CompareTime - compare two dates and time which returns:
71
72 -1 if t1 < t2
73 0 if t1 = t2
74 1 if t1 > t2
75 *)
76
77 PROCEDURE CompareTime (t1, t2: Time) : INTEGER ;
78
79
80 (*
81 TimeToZero - initializes, t, to zero.
82 *)
83
84 PROCEDURE TimeToZero (VAR t: Time) ;
85
86
87 (*
88 TimeToString - convert time, t, to a string.
89 The string, s, should be at least 19 characters
90 long and the returned string will be
91
92 yyyy-mm-dd hh:mm:ss
93 *)
94
95 PROCEDURE TimeToString (t: Time; VAR s: ARRAY OF CHAR) ;
96
97
98 END TimeDate.