forked from MarkHofmann11/WWIVEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WETIME.PAS
51 lines (43 loc) · 978 Bytes
/
WETIME.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
UNIT WETime;
{$I WEGLOBAL.PAS}
{ -- This is the Low Level Time Unit of WWIVEdit 2.2
-- Last Updated : 8/13/91
-- Written By:
-- Adam Caldwell
--
-- This code is Public Domain
--
-- Purpose : Provide Time Functions
--
-- Known Errors : None
--
-- Planned Enhancements : None
--
-- }
INTERFACE
FUNCTION timer:LongInt; { Returns number of seconds past midnight }
FUNCTION time:string; { returns the time of day in 24 hr Format }
IMPLEMENTATION
USES WEString, DOS;
FUNCTION timer : LongInt;
{ Returns the number of seconds after midnight }
VAR
h,m,s,s100 : word;
BEGIN
gettime(h,m,s,s100);
timer := h*longint(3600)+longint(60)*m+longint(1)*s;
END;
FUNCTION Time:String;
VAR
h,m,s,s100:word;
ampm:string[2];
BEGIN
GetTime(h,m,s,s100);
IF h>=12
THEN ampm:='PM'
ELSE ampm:='AM';
IF h>12 THEN dec(h,12)
ELSE IF h=0 THEN h:=12;
Time:=cstr(h)+':'+ZExpand(m,2)+':'+ZExpand(s,2)+' '+ampm;
END;
END.