NWNX:EE  8193.37.14
inc_sqlite_time.nss
Go to the documentation of this file.
1 
9 string SQLite_GetFormattedSystemTime(string format);
10 
13 
16 {
17  int seconds;
19 };
20 
24 
27 string SQLite_GetSystemDate();
28 
31 string SQLite_GetSystemTime();
32 
34 
35 string SQLite_GetFormattedSystemTime(string format)
36 {
37  sqlquery query = SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME(@format, 'now', 'localtime')");
38  SqlBindString(query, "@format", format);
39  SqlStep(query); // sqlite returns NULL for invalid format in STRFTIME()
40  return SqlGetString(query, 0);
41 }
42 
44 {
45  sqlquery query = SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME('%s', 'now')");
46  SqlStep(query);
47  return SqlGetInt(query, 0);
48 }
49 
51 {
52  sqlquery query = SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME('%s', 'now'), SUBSTR(STRFTIME('%f', 'now'), 4)");
53  SqlStep(query);
55  t.seconds = SqlGetInt(query, 0);
56  t.milliseconds = SqlGetInt(query, 1);
57  return t;
58 }
59 
61 {
62  return SQLite_GetFormattedSystemTime("%m/%d/%Y");
63 }
64 
66 {
67  return SQLite_GetFormattedSystemTime("%H:%M:%S");
68 }
string SQLite_GetFormattedSystemTime(string format)
Returns the current time formatted according to the provided sqlite date time format string.
struct SQLite_MillisecondTimeStamp SQLite_GetMillisecondTimeStamp()
int SQLite_GetTimeStamp()
string SQLite_GetSystemTime()
Returns current time.
string SQLite_GetSystemDate()
Returns the current date.
A millisecond timestamp.
int seconds
Seconds since epoch.