17 #include "spinDbAPI.h"
22 int verboseMode =
false;
23 int quietMode =
false;
30 getTimeStamp(
const char *timeformat[] ,
const char *timestr)
38 if(strncmp(timestr,
"now",3)) {
39 memset(&tm,0x0,
sizeof(
struct tm));
40 for(
int i=0; timeformat[i]!=NULL ; i++ ) {
42 if(strptime(timestr,timeformat[i], &tm)!=NULL) {
50 fprintf(stderr,
"time stamp %s not understood\n",timestr);
51 fprintf(stderr,
"\tvalid formats are:\n");
52 for(
int i=0; timeformat[i]!=NULL ; i++ )
53 fprintf(stderr,
"\t%s\n",timeformat[i]);
58 char *tstr=NULL,*nline=NULL;
60 dprintf(
"TIME STAMP: ");
61 tstr=asctime(localtime(&ts));
62 nline=strrchr(tstr,
'\n');
63 if(nline!=NULL) *nline=0x00;
64 dprintf(
"%s (%s)\t",tstr,tzname[daylight]);
66 tstr=asctime(gmtime(&ts));
67 nline=strrchr(tstr,
'\n');
68 if(nline!=NULL) *nline=0x00;
69 dprintf(
"%s (GMT)\n",tstr);
78 timeStringConv1(
const char *a,
char *b) {
96 fmtSqlTime(
const char* sqltime) {
97 static char stringTime[1024];
98 timeStringConv1(sqltime,stringTime);
109 fmt(
const char *s,
const int len) {
110 static char fmtstr[SpinDbMaxDbPathLen];
111 sprintf(fmtstr,
"%s %%%d[A-z0-9 \\t]\n",s,len-1);