Date and time

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

Returns string for current day of week.

Parameters
  • year – Year.

  • month – Month.

  • day – Day.

Returns

Pointer to static buffer containing day of week string.

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.

Parameters
  • DT – Input timestamp.

Returns

time_t value.

int GSM_GetLocalTimezoneOffset(void)

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

Returns

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.

Parameters
  • dt – Input timestamp.

  • TimeZone – Whether to include time zone.

Returns

Pointer to static buffer containing string.

char *OSDate(GSM_DateTime dt)

Converts date from timestamp to string according to OS settings.

Parameters
  • dt – Input timestamp.

Returns

Pointer to static buffer containing string.

gboolean CheckDate(GSM_DateTime *date)

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

Parameters
  • date – Structure where to check date.

Returns

True if date is correct.

gboolean CheckTime(GSM_DateTime *date)

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

Parameters
  • date – Structure where to check time.

Returns

True if time is correct.

GSM_Error GSM_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)

Reads date and time from phone.

Parameters
  • s – State machine pointer.

  • date_time – Storage for date.

Returns

Error code

GSM_Error GSM_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)

Sets date and time in phone.

Parameters
  • s – State machine pointer.

  • date_time – Date to set.

Returns

Error code

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.