1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

Replace time_t with pg_time_t (same values, but always int64) in on-disk

data structures and backend internal APIs.  This solves problems we've seen
recently with inconsistent layout of pg_control between machines that have
32-bit time_t and those that have already migrated to 64-bit time_t.  Also,
we can get out from under the problem that Windows' Unix-API emulation is not
consistent about the width of time_t.

There are a few remaining places where local time_t variables are used to hold
the current or recent result of time(NULL).  I didn't bother changing these
since they do not affect any cross-module APIs and surely all platforms will
have 64-bit time_t before overflow becomes an actual risk.  time_t should
be avoided for anything visible to extension modules, however.
This commit is contained in:
Tom Lane
2008-02-17 02:09:32 +00:00
parent ee7a6770f6
commit cd00406774
17 changed files with 98 additions and 91 deletions

View File

@@ -11,15 +11,14 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.22 2008/01/01 19:45:56 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.23 2008/02/17 02:09:30 tgl Exp $
*/
#ifndef XLOG_INTERNAL_H
#define XLOG_INTERNAL_H
#include <time.h>
#include "access/xlog.h"
#include "fmgr.h"
#include "pgtime.h"
#include "storage/block.h"
#include "storage/relfilenode.h"
@@ -71,7 +70,7 @@ typedef struct XLogContRecord
/*
* Each page of XLOG file has a header like this:
*/
#define XLOG_PAGE_MAGIC 0xD062 /* can be used as WAL version indicator */
#define XLOG_PAGE_MAGIC 0xD063 /* can be used as WAL version indicator */
typedef struct XLogPageHeaderData
{
@@ -242,7 +241,7 @@ extern const RmgrData RmgrTable[];
/*
* Exported to support xlog switching from bgwriter
*/
extern time_t GetLastSegSwitchTime(void);
extern pg_time_t GetLastSegSwitchTime(void);
extern XLogRecPtr RequestXLogSwitch(void);
/*