1/*-------------------------------------------------------------------------
4 * Reimplementations of various backend functions.
6 * Portions Copyright (c) 2013-2025, PostgreSQL Global Development Group
9 * src/bin/pg_waldump/compat.c
11 * This file contains client-side implementations for various backend
12 * functions that the rm_desc functions in *desc.c files rely on.
14 *-------------------------------------------------------------------------
17/* ugly hack, same as in e.g pg_controldata */
25/* copied from timestamp.c */
37 * Stopgap implementation of timestamptz_to_str that doesn't depend on backend
38 * infrastructure. This will work for timestamps that are within the range
39 * of the platform time_t type. (pg_time_t is compatible except for possibly
42 * XXX the return value points to a static buffer, so beware of using more
43 * than one result value concurrently.
45 * XXX: The backend timestamp infrastructure should instead be split out and
46 * moved into src/common. That's a large project though.
55 struct tm *ltime = localtime(&result);
57 strftime(ts,
sizeof(ts),
"%Y-%m-%d %H:%M:%S", ltime);
58 strftime(
zone,
sizeof(
zone),
"%Z", ltime);
const char * timestamptz_to_str(TimestampTz t)
pg_time_t timestamptz_to_time_t(TimestampTz t)
#define POSTGRES_EPOCH_JDATE