Chapter 3 Terminal Specific Function Library
69
3.5 Real-time Clock
This section describes the calendar manipulation routines.
The system date and time are maintained by the calendar chip, and they can be retrieved
from or set to the calendar chip by the
get_time()
and
set_time()
functions. A backup
rechargeable Lithium battery keeps the calendar chip running even when the power is
turned off.
The calendar chip automatically handles the leap year. The year field set to the calendar
chip must be in four-digit format.
Note: The system time variable sys_msec and sys_sec is maintained by CPU timers and
has nothing to do with this calendar chip.
Accuracy of these two time variables depends on the CPU clock and is not suitable
for precise time manipulation. They are reset to 0 upon powering up.
3.5.1 Calendar
DayOfWeek
Purpose
To get the day of the week information.
Syntax
int DayOfWeek (void);
Example
day = DayOfWeek();
Description
This routine returns the day of the week information based on the current date.
Return
1 ~ 6: Monday to Saturday
7: Sunday
See Also
get_time, set_time
get_time
Purpose
To get the current date and time.
Syntax
void get_time (char *cur_time);
char *cur_time; /* pointer to a buffer where date and time will be copied to */
Example
get_time (system_time);
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...