Date and time

char* DayOfWeek(unsigned int year, unsigned int month, unsigned int day)

Returns string for current day of week.

Return
Pointer to static buffer containing day of week string.
Parameters
  • year: Year.
  • month: Month.
  • day: Day.

void GSM_GetCurrentDateTime(GSM_DateTime * Date)

Returns current timestamp.

Parameters
  • Date: Storage for date time structure.

time_t Fill_Time_T(GSM_DateTime DT)

Converts GSM_DateTime to time_t.

Return
time_t value.
Parameters
  • DT: Input timestamp.

int GSM_GetLocalTimezoneOffset(void)

Returns the local timezone offset in seconds. For example 7200 for CEST.

Return
Timezone offset seconds.

void Fill_GSM_DateTime(GSM_DateTime * Date, time_t timet)

Converts time_t to gammu GSM_DateTime structure.

Parameters
  • Date: Storage for date.
  • timet: Input date.

void GSM_DateTimeFromTimestamp(GSM_DateTime * Date, const char * str)

Converts string (seconds since epoch) to gammu GSM_DateTime structure.

Parameters
  • Date: Storage for date.
  • str: Input date.

char* OSDateTime(GSM_DateTime dt, gboolean TimeZone)

Converts timestamp to string according to OS settings.

Return
Pointer to static buffer containing string.
Parameters
  • dt: Input timestamp.
  • TimeZone: Whether to include time zone.

char* OSDate(GSM_DateTime dt)

Converts date from timestamp to string according to OS settings.

Return
Pointer to static buffer containing string.
Parameters
  • dt: Input timestamp.

gboolean CheckDate(GSM_DateTime * date)

Checks whether date is valid. This does not check time, see CheckTime for this.

Return
True if date is correct.
Parameters
  • date: Structure where to check date.

gboolean CheckTime(GSM_DateTime * date)

Checks whether time is valid. This does not check date, see CheckDate for this.

Return
True if time is correct.
Parameters
  • date: Structure where to check time.

GSM_Error GSM_GetDateTime(GSM_StateMachine * s, GSM_DateTime * date_time)

Reads date and time from phone.

Return
Error code
Parameters
  • s: State machine pointer.
  • date_time: Storage for date.

GSM_Error GSM_SetDateTime(GSM_StateMachine * s, GSM_DateTime * date_time)

Sets date and time in phone.

Return
Error code
Parameters
  • s: State machine pointer.
  • date_time: Date to set.

struct GSM_DateTime

Structure used for saving date and time

Public Members

int Timezone

The difference between local time and GMT in seconds

int Second

Seconds.

int Minute

Minutes.

int Hour

Hours.

int Day

Days.

int Month

January = 1, February = 2, etc.

int Year

Complete year number. Not 03, but 2003

struct GSM_DeltaTime

Structure used for saving relative date and time

Public Members

int Timezone

The difference of timezones in seconds

int Second

Seconds diff.

int Minute

Minutes diff.

int Hour

Hours diff.

int Day

Days diff.

int Month

Months diff.

int Year

Years diff.