|
SWILIB API (NSG)
|
Functions for working with date and time.
Usage: #include <swilib.h> or #include <swilib/date.h>
Data Structures | |
| struct | TDate |
| Date of the day. More... | |
| struct | TTime |
| Time of the day. More... | |
| struct | TDateTimeSettings |
| Date & Time settings. More... | |
| struct | TZ |
| Time zone. More... | |
Typedefs | |
| typedef struct TDate | TDate |
| typedef struct TTime | TTime |
| typedef struct TDateTimeSettings | TDateTimeSettings |
| typedef struct TZ | TZ |
Functions | |
| void | InitDate (TDate *date, unsigned long year, uint8_t month, uint8_t day) |
| Initialize TDate structure. | |
| void | InitTime (TTime *time, uint8_t hour, uint8_t min, uint8_t sec, unsigned long millisec) |
| Initialize TTime structure. | |
| TDateTimeSettings * | RamDateTimeSettings (void) |
| Get date and time settings from the phone. | |
| char * | RamIsAutoTimeEnabled (void) |
| Get the address of the "Auto Time" enabled flag. | |
| void | GetDateTime (TDate *date, TTime *time) |
| Get current date and time. | |
| int | GetTimeZoneShift (const TDate *date, const TTime *time, int timezone_id) |
| Get current timezone shift. | |
| char | GetWeek (const TDate *date) |
| Get day of week for a date. | |
| int | GetDays (const TDate *date) |
| Get the days count. | |
| int | IsLeapYear (const TDate *date) |
| Check date for leap year. | |
| int | GetDaysFromMonth (const TDate *date) |
| Get the days count in the month. | |
| int | GetSecondsFromDateTime (uint32_t *seconds, const TDate *date, const TTime *time, const TDate *epoch) |
| Convert date and time to seconds. | |
| int | GetSecondsFromDateTimeSince1997 (uint32_t *seconds, const TDate *date, const TTime *time) |
| Convert date and time to seconds (since 1997-01-01 00:00:00). | |
| int | GetSecondsFromTime (const TTime *time) |
| Calculate seconds from TTime. | |
| void | GetTimeFromSeconds (TTime *time, uint32_t seconds) |
| Convert seconds to TTime. | |
| void | GetTimeFromMilliseconds (TTime *time, uint32_t milliseconds) |
| Convert milliseconds to TTime. | |
| int | GetDateTimeFromSeconds (const uint32_t *seconds, TDate *date, TTime *time, const TDate *epoch) |
| Convert seconds to date and time. | |
| int | GetDateTimeFromSecondsSince1997 (const uint32_t *seconds, TDate *date, TTime *time) |
| Convert seconds to date and time (since 1997-01-01 00:00:00). | |
| int | CmpDates (const TDate *date1, const TDate *date2) |
| Compare two dates. | |
| int | CmpTimes (const TTime *time1, const TTime *time2) |
| Compare two timestamps. | |
| void | GetDate_ws (WSHDR *ws, const TDate *date, unsigned int unk) |
| Put date into ws string. | |
| void | GetTime_ws (WSHDR *ws, const TTime *time, unsigned int unk) |
| Put time into ws string. | |
| void | DateAddDays (TDate *date, int days) |
| Add or subtract days from a date. | |
| void | DateAddMonths (TDate *date, int months) |
| Add or subtract months from a date. | |
| void | DateAddYears (TDate *date, int years) |
| Add or subtract years from a date. | |
| TZ * | RamTimeZones (void) |
| Get array of time zones. | |
| int | GetCurrentTimeZone (void) |
| Get current time zone id. | |
| int | GetTimeZoneByGMT (const char *gmt) |
| Get time zone id by time zone. | |
| int | IsSummerTime (int time_zone) |
| Check time zone for summer time. | |
| void | SetTimeZone (int time_zone) |
| Set time zone. | |
| struct TDate |
| struct TTime |
| struct TDateTimeSettings |
| struct TZ |
| void InitDate | ( | TDate * | date, |
| unsigned long | year, | ||
| uint8_t | month, | ||
| uint8_t | day ) |
Initialize TDate structure.
| date | pointer to the structure to be initialized |
| year,month,day | date of the day |
| void InitTime | ( | TTime * | time, |
| uint8_t | hour, | ||
| uint8_t | min, | ||
| uint8_t | sec, | ||
| unsigned long | millisec ) |
Initialize TTime structure.
| time | pointer to the structure to be initialized |
| hour,min,sec,millisec | time of the day |
| TDateTimeSettings * RamDateTimeSettings | ( | void | ) |
Get date and time settings from the phone.
| char * RamIsAutoTimeEnabled | ( | void | ) |
Get the address of the "Auto Time" enabled flag.
Get current date and time.
| [out] | date | output for current date |
| [out] | time | output for current date |
Get current timezone shift.
| date | current date |
| time | current time |
| timezone_id | ID of the timezone (see RamDateTimeSettings) |
Get day of week for a date.
| date | date of the day |
Get the days count.
| date | date of the day |
Check date for leap year.
| date | date of the day |
Get the days count in the month.
| date | date of the day |
| int GetSecondsFromDateTime | ( | uint32_t * | seconds, |
| const TDate * | date, | ||
| const TTime * | time, | ||
| const TDate * | epoch ) |
Convert date and time to seconds.
| [out] | seconds | output for calculated seconds |
| date | date of the day | |
| time | time of the day | |
| epoch | date of the epoch's start |
Convert date and time to seconds (since 1997-01-01 00:00:00).
| [out] | seconds | output for calculated seconds |
| date | date of the day | |
| time | time of the day |
| void GetTimeFromSeconds | ( | TTime * | time, |
| uint32_t | seconds ) |
Convert seconds to TTime.
| [out] | time | output for calculated time |
| seconds | number of seconds |
| void GetTimeFromMilliseconds | ( | TTime * | time, |
| uint32_t | milliseconds ) |
Convert milliseconds to TTime.
| [out] | time | output for calculated time |
| milliseconds | number of milliseconds |
| int GetDateTimeFromSeconds | ( | const uint32_t * | seconds, |
| TDate * | date, | ||
| TTime * | time, | ||
| const TDate * | epoch ) |
Convert seconds to date and time.
| seconds | a pointer to the seconds | |
| [out] | date | output for calculated date |
| [out] | time | output for calculated time |
| epoch | date of the epoch's start |
Convert seconds to date and time (since 1997-01-01 00:00:00).
| seconds | a pointer to the seconds | |
| [out] | date | output for calculated date |
| [out] | time | output for calculated time |
Compare two dates.
| date1 | date to be compared |
| date2 | date to be compared |
Compare two timestamps.
| time1 | timestamp to be compared |
| time2 | timestamp to be compared |
Put date into ws string.
| [out] | ws | output ws string |
| date | date | |
| unk | unknown parameter for formatting: 0x7, 0xF, ... |
Put time into ws string.
| [out] | ws | output ws string |
| time | time | |
| unk | unkwnow parameter for formatting: 0x223, 0x227, ... |
| void DateAddDays | ( | TDate * | date, |
| int | days ) |
Add or subtract days from a date.
| date | date of the day |
| days | number of days to add (positive) or subtract (negative) |
| void DateAddMonths | ( | TDate * | date, |
| int | months ) |
Add or subtract months from a date.
| date | date of the day |
| months | number of months to add (positive) or subtract (negative) |
| void DateAddYears | ( | TDate * | date, |
| int | years ) |
Add or subtract years from a date.
| date | date of the day |
| years | number of years to add (positive) or subtract (negative) |
| TZ * RamTimeZones | ( | void | ) |
Get array of time zones.
| int GetCurrentTimeZone | ( | void | ) |
Get current time zone id.
| int GetTimeZoneByGMT | ( | const char * | gmt | ) |
Get time zone id by time zone.
| gmt | pointer to the time zone (GMT+03:00, GMT+04:00, etc...). |
| int IsSummerTime | ( | int | time_zone | ) |
Check time zone for summer time.
| time_zone | time zone id |
| void SetTimeZone | ( | int | time_zone | ) |
Set time zone.
| time_zone | time zone id |