diff --git a/contrib/pg_xlogdump/compat.c b/contrib/pg_xlogdump/compat.c
index 99ecad7..0aee756 100644
--- a/contrib/pg_xlogdump/compat.c
+++ b/contrib/pg_xlogdump/compat.c
@@ -52,7 +52,8 @@ timestamptz_to_str(TimestampTz dt)
 	static char buf[MAXDATELEN + 1];
 	static char ts[MAXDATELEN + 1];
 	static char zone[MAXDATELEN + 1];
-	pg_time_t	result = timestamptz_to_time_t(dt);
+	/* cast to time_t so we can use localtime() */
+	time_t	result = (time_t)timestamptz_to_time_t(dt);
 	struct tm  *ltime = localtime(&result);
 
 	strftime(ts, sizeof(zone), "%Y-%m-%d %H:%M:%S", ltime);
