2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: DateStamp() - Get the current date.
8 #include <devices/timer.h>
9 #include <proto/timer.h>
10 #include "dos_intern.h"
12 #define SECONDS_PER_DAY (60UL * 60 * 24)
13 #define SECONDS_PER_MINUTE (60UL)
14 #define uSEC_PER_SEC (1000000UL)
15 #define TICKS_PER_SEC (50UL)
16 #define uSEC_PER_TICK (uSEC_PER_SEC / TICKS_PER_SEC)
18 /*****************************************************************************
21 #include <proto/dos.h>
23 AROS_LH1(struct DateStamp
*, DateStamp
,
26 AROS_LHA(struct DateStamp
*, date
, D1
),
29 struct DosLibrary
*, DOSBase
, 32, Dos
)
32 Fills the structure with the current time. Time is measured from
36 date - The structure to fill.
39 date->ds_Days is filled with the days from Jan 1, 1978.
40 date->ds_Minute is filled with the number of minutes elapsed in the
41 day. date->ds_Tick is the number of ticks elapsed in the current
42 minute. A tick happens 50 times a second. DateStamp() ensures that
43 the day and minute are consistent. All three elements are zero if
47 The original function could only return even multiples of 50 ticks.
57 *****************************************************************************/
61 /* We get the date from the timer.device before splitting it up */
65 date
->ds_Days
= tv
.tv_secs
/ SECONDS_PER_DAY
;
66 tv
.tv_secs
%= SECONDS_PER_DAY
;
67 date
->ds_Minute
= tv
.tv_secs
/ SECONDS_PER_MINUTE
;
68 tv
.tv_secs
%= SECONDS_PER_MINUTE
;
69 date
->ds_Tick
= (tv
.tv_micro
+ tv
.tv_secs
* uSEC_PER_SEC
) /