NWNX:EE  8193.36.12
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 }
SQLite_GetSystemTime
string SQLite_GetSystemTime()
Returns current time.
Definition: inc_sqlite_time.nss:65
SQLite_GetFormattedSystemTime
string SQLite_GetFormattedSystemTime(string format)
Returns the current time formatted according to the provided sqlite date time format string.
Definition: inc_sqlite_time.nss:35
SQLite_MillisecondTimeStamp::seconds
int seconds
Seconds since epoch.
Definition: inc_sqlite_time.nss:17
SQLite_MillisecondTimeStamp::milliseconds
int milliseconds
Milliseconds.
Definition: inc_sqlite_time.nss:18
SQLite_GetTimeStamp
int SQLite_GetTimeStamp()
Definition: inc_sqlite_time.nss:43
SQLite_MillisecondTimeStamp
A millisecond timestamp.
Definition: inc_sqlite_time.nss:15
SQLite_GetSystemDate
string SQLite_GetSystemDate()
Returns the current date.
Definition: inc_sqlite_time.nss:60
SQLite_GetMillisecondTimeStamp
struct SQLite_MillisecondTimeStamp SQLite_GetMillisecondTimeStamp()
Definition: inc_sqlite_time.nss:50