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 * ======== ISeconds ========
38 * Seconds interface.
39 */
40
41 @DirectCall
42 interface ISeconds
43 {
44 /*!
45 * ======== get ========
46 * Returns number of seconds since 1970 (the Unix epoch).
47 *
48 * The user must call Seconds_set() before making any calls to Seconds_get(),
49 * otherwise the value returned by Seconds_get() will be meaningless.
50 */
51 UInt32 get();
52
53 /*!
54 * ======== Time ========
55 * Structure to hold a time value in seconds plus nanoseconds.
56 */
57 struct Time {
58 UInt32 secs; /*! Seconds */
59 UInt32 nsecs; /*! Nanoseconds */
60 };
61
62 /*!
63 * ======== getTime ========
64 * Fills in a Seconds_Time structure with seconds and nanoseconds
65 * elapsed since 1970 (the Unix epoch).
66 *
67 * Seconds_set() must have been called before making any calls to
68 * Seconds_getTime(), otherwise the value returned by Seconds_getTime()
69 * will be meaningless.
70 */
71 UInt32 getTime(ISeconds.Time *ts);
72
73 /*!
74 * ======== set ========
75 * Update the real time clock with number of seconds since 1970.
76 *
77 * Note: This function is non-reentrant.
78 */
79 Void set(UInt32 seconds);
80
81 /*!
82 * ======== setTime ========
83 * Update the real time clock with the number of seconds and nanoseconds
84 * that have elapsed since 1970 (the Unix epoch). The Seconds_Time
85 * structure passed to setTime() contains the seconds and nanoseconds
86 * to set the real time clock to. This API can be called instead
87 * of Seconds_set(), if finer granularity of the time is required.
88 */
89 UInt32 setTime(ISeconds.Time *ts);
90 }