Gammu internals
1.38.0
|
#include <gammu-config.h>
#include <gammu-misc.h>
#include "misc.h"
#include "coding/coding.h"
#include "../debug.h"
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
Go to the source code of this file.
Functions | |
int | RecalcDateTime (struct tm *st, const int year, const int month, const int day, const int hour, const int minute, const int second) |
int | RecalcDate (struct tm *st, const int year, const int month, const int day) |
int | GetDayOfYear (unsigned int year, unsigned int month, unsigned int day) |
int | GetWeekOfMonth (unsigned int year, unsigned int month, unsigned int day) |
int | GetDayOfWeek (unsigned int year, unsigned int month, unsigned int day) |
char * | DayOfWeek (unsigned int year, unsigned int month, unsigned int day) |
int | GSM_GetLocalTimezoneOffset () |
void | GSM_DateTimeToTimestamp (GSM_DateTime *Date, char *str) |
void | GSM_DateTimeFromTimestamp (GSM_DateTime *Date, const char *str) |
void | Fill_GSM_DateTime (GSM_DateTime *Date, time_t timet) |
void | GSM_GetCurrentDateTime (GSM_DateTime *Date) |
time_t | Fill_Time_T (GSM_DateTime DT) |
GSM_DateTime | GSM_AddTime (GSM_DateTime DT, GSM_DeltaTime delta) |
void | GetTimeDifference (unsigned long diff, GSM_DateTime *DT, gboolean Plus, int multi) |
char * | OSDateTime (GSM_DateTime dt, gboolean TimeZone) |
char * | OSDate (GSM_DateTime dt) |
gboolean | CheckDate (GSM_DateTime *date) |
gboolean | CheckTime (GSM_DateTime *date) |
size_t | GetLine (FILE *File, char *Line, int count) |
void | InitLines (GSM_CutLines *lines) |
void | FreeLines (GSM_CutLines *lines) |
void | SplitLines (const char *message, const size_t messagesize, GSM_CutLines *lines, const char *whitespaces, const size_t spaceslen, const char *quotes, const size_t quoteslen, const gboolean eot) |
const char * | GetLineStringPos (const char *message, const GSM_CutLines *lines, int start) |
const char * | GetLineString (const char *message, GSM_CutLines *lines, int start) |
int | GetLineLength (const char *message UNUSED, const GSM_CutLines *lines, int start) |
void | CopyLineString (char *dest, const char *src, const GSM_CutLines *lines, int start) |
const char * | GetOS (void) |
const char * | GetCompiler (void) |
gboolean | GSM_IsNewerVersion (const char *latest_version, const char *current_version) |
void | StripSpaces (char *buff) |
void CopyLineString | ( | char * | dest, |
const char * | src, | ||
const GSM_CutLines * | lines, | ||
int | start | ||
) |
Copies line to variable.
Definition at line 522 of file misc.c.
References GetLineLength(), and GetLineStringPos().
void FreeLines | ( | GSM_CutLines * | lines | ) |
Frees line cut structure.
Definition at line 392 of file misc.c.
References GSM_CutLines::allocated, GSM_CutLines::numbers, and GSM_CutLines::retval.
Referenced by NOKIA_EncodeDateTime().
const char* GetCompiler | ( | void | ) |
Gets compiler which was used to compile Gammu library.
size_t GetLine | ( | FILE * | File, |
char * | Line, | ||
int | count | ||
) |
Reads single line from file.
File | File descriptor to read from. |
Line | Buffer where t ostore result. |
count | Maximal length of text which can be stored in buffer. |
int GetLineLength | ( | const char *message | UNUSED, |
const GSM_CutLines * | lines, | ||
int | start | ||
) |
Definition at line 517 of file misc.c.
References GSM_CutLines::numbers.
Referenced by CopyLineString(), and GetLineString().
const char* GetLineString | ( | const char * | message, |
GSM_CutLines * | lines, | ||
int | start | ||
) |
Returns pointer to static buffer containing line.
message | Parsed message. |
lines | Parsed lines information. |
start | Which line we want. |
Definition at line 492 of file misc.c.
References dbgprintf, GetLineLength(), GetLineStringPos(), and GSM_CutLines::retval.
Referenced by NOKIA_EncodeDateTime().
const char* GetLineStringPos | ( | const char * | message, |
const GSM_CutLines * | lines, | ||
int | start | ||
) |
Definition at line 483 of file misc.c.
References GSM_CutLines::numbers.
Referenced by CopyLineString(), and GetLineString().
const char* GetOS | ( | void | ) |
Gets host OS.
Definition at line 537 of file misc.c.
Referenced by GSM_InitConnection_Log().
void GetTimeDifference | ( | unsigned long | diff, |
GSM_DateTime * | DT, | ||
gboolean | Plus, | ||
int | multi | ||
) |
Definition at line 247 of file misc.c.
References GSM_DateTime::Day, dbgprintf, Fill_GSM_DateTime(), Fill_Time_T(), GSM_DateTime::Hour, GSM_DateTime::Minute, GSM_DateTime::Month, GSM_DateTime::Second, and GSM_DateTime::Year.
Referenced by GSM_GetCalendarRecurranceRepeat(), and NOKIA_EncodeDateTime().
GSM_DateTime GSM_AddTime | ( | GSM_DateTime | DT, |
GSM_DeltaTime | delta | ||
) |
Definition at line 223 of file misc.c.
References GSM_DateTime::Day, GSM_DeltaTime::Day, Fill_GSM_DateTime(), GSM_DateTime::Hour, GSM_DeltaTime::Hour, GSM_DateTime::Minute, GSM_DeltaTime::Minute, GSM_DateTime::Month, GSM_DateTime::Second, GSM_DeltaTime::Second, and GSM_DateTime::Year.
Referenced by GSM_Calendar_AdjustDate(), GSM_DecodeVCALENDAR_VTODO(), and GSM_ToDo_AdjustDate().
gboolean GSM_IsNewerVersion | ( | const char * | latest_version, |
const char * | current_version | ||
) |
void InitLines | ( | GSM_CutLines * | lines | ) |
Initializes line cut structure.
Definition at line 385 of file misc.c.
References GSM_CutLines::allocated, GSM_CutLines::numbers, and GSM_CutLines::retval.
Referenced by NOKIA_EncodeDateTime().
int RecalcDate | ( | struct tm * | st, |
const int | year, | ||
const int | month, | ||
const int | day | ||
) |
Recalculates struct tm content.
Definition at line 84 of file misc.c.
References RecalcDateTime().
Referenced by GetDayOfWeek(), GetDayOfYear(), and GetWeekOfMonth().
int RecalcDateTime | ( | struct tm * | st, |
const int | year, | ||
const int | month, | ||
const int | day, | ||
const int | hour, | ||
const int | minute, | ||
const int | second | ||
) |
Recalculates struct tm content. We can not use mktime directly, as it works only for dates > 1970. Day of week calculation is nased on article in Polish PC-Kurier 8/1998 page 104.
Definition at line 38 of file misc.c.
References CheckDate(), CheckTime(), GSM_DateTime::Day, GSM_DateTime::Hour, GSM_DateTime::Minute, GSM_DateTime::Month, GSM_DateTime::Second, GSM_DateTime::Timezone, and GSM_DateTime::Year.
Referenced by OSDateTime(), and RecalcDate().
void SplitLines | ( | const char * | message, |
const size_t | messagesize, | ||
GSM_CutLines * | lines, | ||
const char * | whitespaces, | ||
const size_t | spaceslen, | ||
const char * | quotes, | ||
const size_t | quoteslen, | ||
const gboolean | eot | ||
) |
Calculates string cut points to split it to lines.
Definition at line 401 of file misc.c.
References GSM_CutLines::allocated, FALSE, GSM_CutLines::numbers, and TRUE.
Referenced by NOKIA_EncodeDateTime().
void StripSpaces | ( | char * | buff | ) |
Strips spaces from string.
[in,out] | buff | String where to strip buffers. |
Definition at line 713 of file misc.c.
Referenced by GSM_InitConnection_Log().