We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2da77c commit 9bc9b46Copy full SHA for 9bc9b46
src/interfaces/libpq/fe-trace.c
@@ -80,11 +80,20 @@ static void
80
pqTraceFormatTimestamp(char *timestr, size_t ts_len)
81
{
82
struct timeval tval;
83
+ time_t now;
84
85
gettimeofday(&tval, NULL);
86
+
87
+ /*
88
+ * MSVC's implementation of timeval uses a long for tv_sec, however,
89
+ * localtime() expects a time_t pointer. Here we'll assign tv_sec to a
90
+ * local time_t variable so that we pass localtime() the correct pointer
91
+ * type.
92
+ */
93
+ now = tval.tv_sec;
94
strftime(timestr, ts_len,
95
"%Y-%m-%d %H:%M:%S",
- localtime(&tval.tv_sec));
96
+ localtime(&now));
97
/* append microseconds */
98
snprintf(timestr + strlen(timestr), ts_len - strlen(timestr),
99
".%06u", (unsigned int) (tval.tv_usec));
0 commit comments