summaryrefslogtreecommitdiff
path: root/statement.c
diff options
context:
space:
mode:
Diffstat (limited to 'statement.c')
-rw-r--r--statement.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/statement.c b/statement.c
index 69ee387..05f7c78 100644
--- a/statement.c
+++ b/statement.c
@@ -1168,6 +1168,8 @@ SC_clear_error(StatementClass *self)
res->sqlstate[0] = '\0';
}
self->stmt_time = 0;
+ memset(&self->localtime, 0, sizeof(self->localtime));
+ self->localtime.tm_sec = -1;
SC_unref_CC_error(self);
}
@@ -1546,6 +1548,25 @@ SC_get_time(StatementClass *stmt)
return stmt->stmt_time;
}
+struct tm *
+SC_get_localtime(StatementClass *stmt)
+{
+ struct tm * tim;
+
+ if (stmt->localtime.tm_sec < 0)
+ {
+ SC_get_time(stmt);
+#ifdef HAVE_LOCALTIME_R
+ tim = localtime_r(&stmt->stmt_time, &(stmt->localtime));
+#else
+ tim = localtime(&stmt->stmt_time);
+ stmt->localtime = *tim;
+#endif /* HAVE_LOCALTIME_R */
+ }
+
+ return &(stmt->localtime);
+}
+
RETCODE
SC_fetch(StatementClass *self)
{