mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 22:19:14 +00:00
Localtime.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "sqlite3.h"
|
||||
|
||||
@@ -7,6 +8,8 @@ int main() {
|
||||
if (rc != SQLITE_OK) return 1;
|
||||
}
|
||||
|
||||
int go_localtime(sqlite3_int64, struct tm *);
|
||||
|
||||
int go_randomness(sqlite3_vfs *, int nByte, char *zOut);
|
||||
int go_sleep(sqlite3_vfs *, int microseconds);
|
||||
int go_current_time(sqlite3_vfs *, double *);
|
||||
@@ -48,6 +51,10 @@ static int no_file_control(sqlite3_file *pFile, int op, void *pArg) {
|
||||
static int no_sector_size(sqlite3_file *pFile) { return 0; }
|
||||
static int no_device_characteristics(sqlite3_file *pFile) { return 0; }
|
||||
|
||||
int localtime_s(struct tm *const pTm, time_t const *const pTime) {
|
||||
return go_localtime((sqlite3_int64)*pTime, pTm);
|
||||
}
|
||||
|
||||
static int go_open_c(sqlite3_vfs *vfs, sqlite3_filename zName,
|
||||
sqlite3_file *file, int flags, int *pOutFlags) {
|
||||
static const sqlite3_io_methods go_io = {
|
||||
|
||||
36
sqlite3/sqlite_cfg.h
Normal file
36
sqlite3/sqlite_cfg.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <time.h>
|
||||
|
||||
// Platform Configuration
|
||||
|
||||
#define SQLITE_OS_OTHER 1
|
||||
#define SQLITE_BYTEORDER 1234
|
||||
|
||||
#define HAVE_ISNAN 1
|
||||
#define HAVE_USLEEP 1
|
||||
#define HAVE_LOCALTIME_S 1
|
||||
#define HAVE_MALLOC_USABLE_SIZE 1
|
||||
|
||||
// Recommended Options
|
||||
|
||||
#define SQLITE_DQS 0
|
||||
#define SQLITE_THREADSAFE 0
|
||||
#define SQLITE_DEFAULT_MEMSTATUS 0
|
||||
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1
|
||||
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS
|
||||
#define SQLITE_MAX_EXPR_DEPTH 0
|
||||
#define SQLITE_OMIT_DECLTYPE
|
||||
#define SQLITE_OMIT_DEPRECATED
|
||||
#define SQLITE_OMIT_PROGRESS_CALLBACK
|
||||
#define SQLITE_OMIT_SHARED_CACHE
|
||||
#define SQLITE_OMIT_AUTOINIT
|
||||
#define SQLITE_USE_ALLOCA
|
||||
|
||||
// Need this to access WAL databases without the use of shared memory.
|
||||
#define SQLITE_DEFAULT_LOCKING_MODE 1
|
||||
// Go uses UTF-8 everywhere.
|
||||
#define SQLITE_OMIT_UTF16
|
||||
// Remove some testing code.
|
||||
#define SQLITE_UNTESTABLE
|
||||
|
||||
// Implemented in Go.
|
||||
int localtime_s(struct tm *const pTm, time_t const *const pTime);
|
||||
Reference in New Issue
Block a user