LIBOBJS="$LIBOBJS rand.$ac_objext" ;;
esac
-# Win32 can't to rename or unlink on an open file
+# Win32 can't do rename or unlink on an open file
case $host_os in mingw*|cygwin*)
LIBOBJS="$LIBOBJS dirmod.$ac_objext" ;;
esac
dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.355 2004/05/20 23:49:41 pgsql Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.356 2004/05/21 05:07:54 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
dnl 0. Initialization and options processing
dnl 1. Programs
dnl 2. Libraries
-dnl 3. Header files
+dnl 3. Header files
dnl 4. Types
dnl 5. Structures
dnl 6. Compiler characteristics
AC_LIBOBJ(rand) ;;
esac
-# Win32 can't to rename or unlink on an open file
+# Win32 can't do rename or unlink on an open file
case $host_os in mingw*|cygwin*)
AC_LIBOBJ(dirmod) ;;
esac
-<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.39 2004/03/15 16:11:42 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.40 2004/05/21 05:07:55 tgl Exp $ -->
<chapter id="regress">
<title id="regress-title">Regression Tests</title>
</para>
<para>
- For example: some systems using older time zone libraries fail to apply
- daylight-saving corrections to dates before 1970, causing
- pre-1970 <acronym>PDT</acronym> times to be displayed in <acronym>PST</acronym> instead. This causes a
- few differences in the <filename>horology</> regression test.
+ For example: some systems interpret very small floating-point values
+ as zero, rather than reporting an underflow error. This causes a
+ few differences in the <filename>float8</> regression test.
Therefore, we provide a variant comparison file,
- <filename>horology-no-DST-before-1970.out</filename>, which includes
+ <filename>float8-small-is-zero.out</filename>, which includes
the results to be expected on these systems. To silence the bogus
- <quote>failure</quote> message on <systemitem>HPUX</systemitem> platforms,
- <filename>resultmap</filename> includes
+ <quote>failure</quote> message on <systemitem>OpenBSD</systemitem>
+ platforms, <filename>resultmap</filename> includes
<programlisting>
-horology/.*-hpux=horology-no-DST-before-1970
+float8/i.86-.*-openbsd=float8-small-is-zero
</programlisting>
which will trigger on any machine for which the output of
- <command>config.guess</command> includes <literal>-hpux</literal>.
+ <command>config.guess</command> matches <literal>i.86-.*-openbsd</literal>.
Other lines
in <filename>resultmap</> select the variant comparison file for other
platforms where it's appropriate.
# -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.184 2004/05/14 00:03:07 momjian Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.185 2004/05/21 05:07:55 tgl Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_XINCLUDES = @TK_XINCLUDES@
-USE_PGTZ = @USE_PGTZ@
-
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
#
# Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/backend/Makefile,v 1.99 2004/04/30 16:08:01 momjian Exp $
+# $PostgreSQL: pgsql/src/backend/Makefile,v 1.100 2004/05/21 05:07:55 tgl Exp $
#
#-------------------------------------------------------------------------
DIRS := access bootstrap catalog parser commands executor lib libpq \
main nodes optimizer port postmaster regex rewrite \
- storage tcop utils
-
-ifeq ($(USE_PGTZ), yes)
-DIRS+= $(top_builddir)/src/timezone
-endif
+ storage tcop utils $(top_builddir)/src/timezone
OBJS := $(DIRS:%=%/SUBSYS.o)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.165 2004/04/05 03:11:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.166 2004/05/21 05:07:56 tgl Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
if (info == XLOG_XACT_COMMIT)
{
xl_xact_commit *xlrec = (xl_xact_commit *) rec;
- struct tm *tm = localtime(&xlrec->xtime);
+ struct pg_tm *tm = pg_localtime(&xlrec->xtime);
sprintf(buf + strlen(buf), "commit: %04u-%02u-%02u %02u:%02u:%02u",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
else if (info == XLOG_XACT_ABORT)
{
xl_xact_abort *xlrec = (xl_xact_abort *) rec;
- struct tm *tm = localtime(&xlrec->xtime);
+ struct pg_tm *tm = pg_localtime(&xlrec->xtime);
sprintf(buf + strlen(buf), "abort: %04u-%02u-%02u %02u:%02u:%02u",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.140 2004/05/07 00:24:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.141 2004/05/21 05:07:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include "access/clog.h"
#include "access/transam.h"
{
static char buf[128];
- strftime(buf, sizeof(buf),
+ pg_strftime(buf, sizeof(buf),
"%Y-%m-%d %H:%M:%S %Z",
- localtime(&tnow));
+ pg_localtime(&tnow));
return buf;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.66 2004/05/05 04:48:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.67 2004/05/21 05:07:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include <time.h>
#include <unistd.h>
#include "access/attnum.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
+#include "pgtime.h"
#include "rewrite/prs2lock.h"
#include "storage/block.h"
#include "storage/fd.h"
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.33 2004/02/24 22:06:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.34 2004/05/21 05:07:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include <time.h>
-
#include "access/attnum.h"
#include "access/htup.h"
#include "access/itup.h"
#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
#include "parser/scansup.h"
+#include "pgtime.h"
#include "rewrite/prs2lock.h"
#include "storage/block.h"
#include "storage/fd.h"
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.178 2004/04/01 21:28:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.179 2004/05/21 05:07:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <unistd.h>
-#include <time.h>
#include <signal.h>
#include <setjmp.h>
#ifdef HAVE_GETOPT_H
#include "executor/executor.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
+#include "pgtime.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
#include "storage/pg_shmem.h"
if (IsUnderPostmaster)
{
#ifdef EXEC_BACKEND
- read_nondefault_variables();
read_backend_variables(backendID,NULL);
+ read_nondefault_variables();
SSDataBaseInit(xlogop);
#endif
else
ProcessConfigFile(PGC_POSTMASTER);
+ /* If timezone is not set, determine what the OS uses */
+ pg_timezone_initialize();
+
if (IsUnderPostmaster)
{
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.94 2004/05/07 00:24:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.95 2004/05/21 05:07:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <ctype.h>
-#include <time.h>
#include "access/xact.h"
#include "catalog/pg_shadow.h"
#include "commands/variable.h"
#include "miscadmin.h"
#include "parser/scansup.h"
+#include "pgtime.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/syscache.h"
#include "utils/tqual.h"
#include "mb/pg_wchar.h"
-/*
- * Some systems have tzname[] but don't declare it in <time.h>. Use this
- * to duplicate the test in AC_STRUCT_TIMEZONE.
- */
-#ifdef HAVE_TZNAME
-#ifndef tzname /* For SGI. */
-extern char *tzname[];
-#endif
-#endif
-
-
/*
* DATESTYLE
*/
* TIMEZONE
*/
-/*
- * Storage for TZ env var is allocated with an arbitrary size of 64 bytes.
- */
-#define TZBUF_LEN 64
-
-static char tzbuf[TZBUF_LEN];
-
-/*
- * First time through, we remember the original environment TZ value, if any.
- */
-static bool have_saved_tz = false;
-static char orig_tzbuf[TZBUF_LEN];
-
-/*
- * Convenience subroutine for assigning the value of TZ
- */
-static void
-set_tz(const char *tz)
-{
- strcpy(tzbuf, "TZ=");
- strncpy(tzbuf + 3, tz, sizeof(tzbuf) - 4);
- if (putenv(tzbuf) != 0) /* shouldn't happen? */
- elog(LOG, "could not set TZ environment variable");
- tzset();
-}
-
-/*
- * Remove any value of TZ we have established
- *
- * Note: this leaves us with *no* value of TZ in the environment, and
- * is therefore only appropriate for reverting to that state, not for
- * reverting to a state where TZ was set to something else.
- */
-static void
-clear_tz(void)
-{
- /*
- * unsetenv() works fine, but is BSD, not POSIX, and is not available
- * under Solaris, among others. Apparently putenv() called as below
- * clears the process-specific environment variables. Other
- * reasonable arguments to putenv() (e.g. "TZ=", "TZ", "") result in a
- * core dump (under Linux anyway). - thomas 1998-01-26
- */
- if (tzbuf[0] == 'T')
- {
- strcpy(tzbuf, "=");
- if (putenv(tzbuf) != 0)
- elog(LOG, "could not clear TZ environment variable");
- tzset();
- }
-}
-
-/*
- * Check whether tzset() succeeded
- *
- * Unfortunately, tzset doesn't offer any well-defined way to detect that the
- * value of TZ was bad. Often it will just select UTC (GMT) as the effective
- * timezone. We use the following heuristics:
- *
- * If tzname[1] is a nonempty string, *or* the global timezone variable is
- * not zero, then tzset must have recognized the TZ value as something
- * different from UTC. Return true.
- *
- * Otherwise, check to see if the TZ name is a known spelling of "UTC"
- * (ie, appears in our internal tables as a timezone equivalent to UTC).
- * If so, accept it.
- *
- * This will reject nonstandard spellings of UTC unless tzset() chose to
- * set tzname[1] as well as tzname[0]. The glibc version of tzset() will
- * do so, but on other systems we may be tightening the spec a little.
- *
- * Another problem is that on some platforms (eg HPUX), if tzset thinks the
- * input is bogus then it will adopt the system default timezone, which we
- * really can't tell is not the intended translation of the input.
- *
- * Still, it beats failing to detect bad TZ names at all, and a silent
- * failure mode of adopting the system-wide default is much better than
- * a silent failure mode of adopting UTC.
- *
- * NB: this must NOT ereport(ERROR). The caller must get control back so that
- * it can restore the old value of TZ if we don't like the new one.
- */
-static bool
-tzset_succeeded(const char *tz)
-{
- char *tztmp;
- int tzval;
-
- /*
- * Check first set of heuristics to say that tzset definitely worked.
- */
-#ifdef HAVE_TZNAME
- if (tzname[1] && tzname[1][0] != '\0')
- return true;
-#endif
- if (TIMEZONE_GLOBAL != 0)
- return true;
-
- /*
- * Check for known spellings of "UTC". Note we must downcase the
- * input before passing it to DecodePosixTimezone().
- */
- tztmp = downcase_truncate_identifier(tz, strlen(tz), false);
- if (DecodePosixTimezone(tztmp, &tzval) == 0)
- if (tzval == 0)
- return true;
-
- return false;
-}
-
-/*
- * Check whether timezone is acceptable.
- *
- * What we are doing here is checking for leap-second-aware timekeeping.
- * We need to reject such TZ settings because they'll wreak havoc with our
- * date/time arithmetic.
- *
- * NB: this must NOT ereport(ERROR). The caller must get control back so that
- * it can restore the old value of TZ if we don't like the new one.
- */
-static bool
-tz_acceptable(void)
-{
- struct tm tt;
- time_t time2000;
-
- /*
- * To detect leap-second timekeeping, compute the time_t value for
- * local midnight, 2000-01-01. Insist that this be a multiple of 60;
- * any partial-minute offset has to be due to leap seconds.
- */
- MemSet(&tt, 0, sizeof(tt));
- tt.tm_year = 100;
- tt.tm_mon = 0;
- tt.tm_mday = 1;
- tt.tm_isdst = -1;
- time2000 = mktime(&tt);
- if ((time2000 % 60) != 0)
- return false;
-
- return true;
-}
-
/*
* assign_timezone: GUC assign_hook for timezone
*/
char *endptr;
double hours;
- /*
- * On first call, see if there is a TZ in the original environment.
- * Save that value permanently.
- */
- if (!have_saved_tz)
- {
- char *orig_tz = getenv("TZ");
-
- if (orig_tz)
- StrNCpy(orig_tzbuf, orig_tz, sizeof(orig_tzbuf));
- else
- orig_tzbuf[0] = '\0';
- have_saved_tz = true;
- }
-
/*
* Check for INTERVAL 'foo'
*/
{
/*
* UNKNOWN is the value shown as the "default" for TimeZone in
- * guc.c. We interpret it as meaning the original TZ
- * inherited from the environment. Note that if there is an
- * original TZ setting, we will return that rather than
+ * guc.c. We interpret it as being a complete no-op; we don't
+ * change the timezone setting. Note that if there is a known
+ * timezone setting, we will return that name rather than
* UNKNOWN as the canonical spelling.
+ *
+ * During GUC initialization, since the timezone library isn't
+ * set up yet, pg_get_current_timezone will return NULL and we
+ * will leave the setting as UNKNOWN. If this isn't overridden
+ * from the config file then pg_timezone_initialize() will
+ * eventually select a default value from the environment.
*/
- if (doit)
- {
- bool ok;
-
- /* Revert to original setting of TZ, whatever it was */
- if (orig_tzbuf[0])
- {
- set_tz(orig_tzbuf);
- ok = tzset_succeeded(orig_tzbuf) && tz_acceptable();
- }
- else
- {
- clear_tz();
- ok = tz_acceptable();
- }
+ const char *curzone = pg_get_current_timezone();
- if (ok)
- HasCTZSet = false;
- else
- {
- /* Bogus, so force UTC (equivalent to INTERVAL 0) */
- CTimeZone = 0;
- HasCTZSet = true;
- }
- }
+ if (curzone)
+ value = curzone;
}
else
{
*
* We have to actually apply the change before we can have any
* hope of checking it. So, save the old value in case we
- * have to back out. Note that it's possible the old setting
- * is in tzbuf, so we'd better copy it.
+ * have to back out. We have to copy since pg_get_current_timezone
+ * returns a pointer to its static state.
*/
- char save_tzbuf[TZBUF_LEN];
+ const char *cur_tz;
char *save_tz;
bool known,
acceptable;
- save_tz = getenv("TZ");
- if (save_tz)
- StrNCpy(save_tzbuf, save_tz, sizeof(save_tzbuf));
-
- set_tz(value);
+ cur_tz = pg_get_current_timezone();
+ if (cur_tz)
+ save_tz = pstrdup(cur_tz);
+ else
+ save_tz = NULL;
- known = tzset_succeeded(value);
- acceptable = tz_acceptable();
+ known = pg_tzset(value);
+ acceptable = known ? tz_acceptable() : false;
if (doit && known && acceptable)
{
* a fixed offset, we still are.
*/
if (save_tz)
- set_tz(save_tzbuf);
- else
- clear_tz();
+ pg_tzset(save_tz);
+ else /* TZ library not initialized yet */
+ select_default_timezone();
/* Complain if it was bad */
if (!known)
{
/*
* Prepare the canonical string to return. GUC wants it malloc'd.
*/
- result = (char *) malloc(sizeof(tzbuf));
- if (!result)
- return NULL;
-
if (HasCTZSet)
- snprintf(result, sizeof(tzbuf), "%.5f",
+ {
+ result = (char *) malloc(64);
+ if (!result)
+ return NULL;
+ snprintf(result, 64, "%.5f",
(double) (-CTimeZone) / 3600.0);
- else if (tzbuf[0] == 'T')
- strcpy(result, tzbuf + 3);
+ }
else
- strcpy(result, "UNKNOWN");
+ result = strdup(value);
return result;
}
const char *
show_timezone(void)
{
- char *tzn;
+ const char *tzn;
if (HasCTZSet)
{
IntervalPGetDatum(&interval)));
}
else
- tzn = getenv("TZ");
+ tzn = pg_get_current_timezone();
if (tzn != NULL)
return tzn;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.43 2004/01/23 23:54:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.44 2004/05/21 05:07:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include <time.h>
#include <math.h>
#include "optimizer/geqo.h"
#include "optimizer/geqo_mutation.h"
#include "optimizer/geqo_pool.h"
#include "optimizer/geqo_selection.h"
+#include "pgtime.h"
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.392 2004/05/19 19:11:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.393 2004/05/21 05:07:57 tgl Exp $
*
* NOTES
*
#include <sys/wait.h>
#include <ctype.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/socket.h>
#include <errno.h>
#include <fcntl.h>
-#include <time.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "libpq/pqsignal.h"
#include "miscadmin.h"
#include "nodes/nodes.h"
+#include "pgtime.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "storage/pg_shmem.h"
SetDataDir(potential_DataDir);
ProcessConfigFile(PGC_POSTMASTER);
+
+ /* If timezone is not set, determine what the OS uses */
+ pg_timezone_initialize();
+
#ifdef EXEC_BACKEND
write_nondefault_variables(PGC_POSTMASTER);
#endif
{
time_t now = time(NULL);
- (void) localtime(&now);
+ (void) pg_localtime(&now);
}
/*
DataDir = strdup(argv[argc++]);
/* Read in file-based context */
- read_nondefault_variables();
read_backend_variables(backendID,&port);
+ read_nondefault_variables();
/* Remaining initialization */
pgstat_init_forkexec_backend();
write_var(debug_flag,fp);
write_var(PostmasterPid,fp);
+ fwrite((void *)my_exec_path, MAXPGPATH, 1, fp);
+
/* Release file */
if (FreeFile(fp))
{
read_var(debug_flag,fp);
read_var(PostmasterPid,fp);
+ fread((void *)my_exec_path, MAXPGPATH, 1, fp);
+
/* Release file */
FreeFile(fp);
if (unlink(filename) != 0)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.412 2004/05/19 21:17:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.413 2004/05/21 05:07:58 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
#include <unistd.h>
#include <signal.h>
-#include <time.h>
-#include <sys/time.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <errno.h>
#include "optimizer/planner.h"
#include "parser/analyze.h"
#include "parser/parser.h"
+#include "pgtime.h"
#include "rewrite/rewriteHandler.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
char stack_base;
StringInfoData input_message;
volatile bool send_rfq = true;
-
+
/*
* Catch standard options before doing much else. This even works on
* systems without getopt_long.
} else
ProcessConfigFile(PGC_POSTMASTER);
+ /* If timezone is not set, determine what the OS uses */
+ pg_timezone_initialize();
+
/*
* Set up signal handlers and masks.
*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.96 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.97 2004/05/21 05:08:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <ctype.h>
#include <limits.h>
-#include <time.h>
#include <float.h>
#include "access/hash.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "parser/scansup.h"
+#include "pgtime.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/nabstime.h"
#endif
-static int time2tm(TimeADT time, struct tm * tm, fsec_t *fsec);
-static int timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp);
-static int tm2time(struct tm * tm, fsec_t fsec, TimeADT *result);
-static int tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
+static int time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec);
+static int timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp);
+static int tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result);
+static int tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
/*****************************************************************************
char *str = PG_GETARG_CSTRING(0);
DateADT date;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tzp;
int dtype;
{
DateADT date = PG_GETARG_DATEADT(0);
char *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
char buf[MAXDATELEN + 1];
date2timestamptz(DateADT dateVal)
{
TimestampTz result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
j2date(dateVal + POSTGRES_EPOCH_JDATE,
{
Timestamp timestamp = PG_GETARG_TIMESTAMP(0);
DateADT result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
DateADT result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
int tz;
{
AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
DateADT result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
int32 typmod = PG_GETARG_INT32(2);
TimeADT result;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
int nf;
* Convert a tm structure to a time data type.
*/
static int
-tm2time(struct tm * tm, fsec_t fsec, TimeADT *result)
+tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result)
{
#ifdef HAVE_INT64_TIMESTAMP
*result = ((((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec)
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
*/
static int
-time2tm(TimeADT time, struct tm * tm, fsec_t *fsec)
+time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec)
{
#ifdef HAVE_INT64_TIMESTAMP
tm->tm_hour = (time / INT64CONST(3600000000));
{
TimeADT time = PG_GETARG_TIMEADT(0);
char *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
char buf[MAXDATELEN + 1];
{
Timestamp timestamp = PG_GETARG_TIMESTAMP(0);
TimeADT result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
TimeADT result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
fsec_t fsec;
if (type == UNITS)
{
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
time2tm(time, tm, &fsec);
* Convert a tm structure to a time data type.
*/
static int
-tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result)
+tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result)
{
#ifdef HAVE_INT64_TIMESTAMP
result->time = ((((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec)
int32 typmod = PG_GETARG_INT32(2);
TimeTzADT *result;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
int nf;
{
TimeTzADT *time = PG_GETARG_TIMETZADT_P(0);
char *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
int tz;
* Convert TIME WITH TIME ZONE data type to POSIX time structure.
*/
static int
-timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp)
+timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp)
{
#ifdef HAVE_INT64_TIMESTAMP
int64 trem = time->time;
{
TimeADT time = PG_GETARG_TIMEADT(0);
TimeTzADT *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
int tz;
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
TimeTzADT *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
fsec_t fsec;
double dummy;
int tz;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
timetz2tm(time, tm, &fsec, &tz);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.127 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.128 2004/05/21 05:08:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static int DecodeNumber(int flen, char *field, bool haveTextMonth,
int fmask, int *tmask,
- struct tm * tm, fsec_t *fsec, int *is2digits);
+ struct pg_tm * tm, fsec_t *fsec, int *is2digits);
static int DecodeNumberField(int len, char *str,
int fmask, int *tmask,
- struct tm * tm, fsec_t *fsec, int *is2digits);
+ struct pg_tm * tm, fsec_t *fsec, int *is2digits);
static int DecodeTime(char *str, int fmask, int *tmask,
- struct tm * tm, fsec_t *fsec);
+ struct pg_tm * tm, fsec_t *fsec);
static int DecodeTimezone(char *str, int *tzp);
+static int DecodePosixTimezone(char *str, int *tzp);
static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
-static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
+static int DecodeDate(char *str, int fmask, int *tmask, struct pg_tm * tm);
static void TrimTrailingZeros(char *str);
*/
int
DecodeDateTime(char **field, int *ftype, int nf,
- int *dtype, struct tm * tm, fsec_t *fsec, int *tzp)
+ int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp)
{
int fmask = 0,
tmask,
/* DetermineLocalTimeZone()
*
- * Given a struct tm in which tm_year, tm_mon, tm_mday, tm_hour, tm_min, and
+ * Given a struct pg_tm in which tm_year, tm_mon, tm_mday, tm_hour, tm_min, and
* tm_sec fields are set, attempt to determine the applicable local zone
- * (ie, regular or daylight-savings time) at that time. Set the struct tm's
+ * (ie, regular or daylight-savings time) at that time. Set the struct pg_tm's
* tm_isdst field accordingly, and return the actual timezone offset.
*
* Note: this subroutine exists because mktime() has such a spectacular
* mktime() anywhere else.
*/
int
-DetermineLocalTimeZone(struct tm * tm)
+DetermineLocalTimeZone(struct pg_tm * tm)
{
int tz;
delta1,
delta2;
time_t mytime;
- struct tm *tx;
+ struct pg_tm *tx;
day = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - UNIX_EPOCH_JDATE;
mysec = tm->tm_sec + (tm->tm_min + (day * 24 + tm->tm_hour) * 60) * 60;
* Use localtime to convert that time_t to broken-down time,
* and reassemble to get a representation of local time.
*/
- tx = localtime(&mytime);
+ tx = pg_localtime(&mytime);
if (!tx)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
* computable as mysec - locsec.
*/
delta1 = mysec - locsec;
-
/*
* However, if that GMT time and the local time we are
* actually interested in are on opposite sides of a
*/
mysec += delta1;
mytime = (time_t) mysec;
- tx = localtime(&mytime);
+ tx = pg_localtime(&mytime);
if (!tx)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
{
mysec += (delta2 - delta1);
mytime = (time_t) mysec;
- tx = localtime(&mytime);
+ tx = pg_localtime(&mytime);
if (!tx)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
*/
int
DecodeTimeOnly(char **field, int *ftype, int nf,
- int *dtype, struct tm * tm, fsec_t *fsec, int *tzp)
+ int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp)
{
int fmask = 0,
tmask,
/* timezone not specified? then find local timezone if possible */
if ((tzp != NULL) && (!(fmask & DTK_M(TZ))))
{
- struct tm tt,
+ struct pg_tm tt,
*tmp = &tt;
/*
* Insist on a complete set of fields.
*/
static int
-DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
+DecodeDate(char *str, int fmask, int *tmask, struct pg_tm * tm)
{
fsec_t fsec;
int nf = 0;
* can be used to represent time spans.
*/
static int
-DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec)
+DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
{
char *cp;
*/
static int
DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
- int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
+ int *tmask, struct pg_tm * tm, fsec_t *fsec, int *is2digits)
{
int val;
char *cp;
*/
static int
DecodeNumberField(int len, char *str, int fmask,
- int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
+ int *tmask, struct pg_tm * tm, fsec_t *fsec, int *is2digits)
{
char *cp;
* - thomas 2000-03-15
*
* Return 0 if okay (and set *tzp), a DTERR code if not okay.
- *
- * NB: this must *not* ereport on failure; see commands/variable.c.
*/
-int
+static int
DecodePosixTimezone(char *str, int *tzp)
{
int val,
* preceding an hh:mm:ss field. - thomas 1998-04-30
*/
int
-DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fsec_t *fsec)
+DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm, fsec_t *fsec)
{
int is_before = FALSE;
char *cp;
* Encode date as local time.
*/
int
-EncodeDateOnly(struct tm * tm, int style, char *str)
+EncodeDateOnly(struct pg_tm * tm, int style, char *str)
{
if ((tm->tm_mon < 1) || (tm->tm_mon > 12))
return -1;
* Encode time fields only.
*/
int
-EncodeTimeOnly(struct tm * tm, fsec_t fsec, int *tzp, int style, char *str)
+EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
{
if ((tm->tm_hour < 0) || (tm->tm_hour > 24))
return -1;
* European - dd/mm/yyyy
*/
int
-EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str)
+EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str)
{
int day,
hour,
* - thomas 1998-04-30
*/
int
-EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str)
+EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
{
int is_before = FALSE;
int is_nonzero = FALSE;
/* -----------------------------------------------------------------------
* formatting.c
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.74 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.75 2004/05/21 05:08:02 tgl Exp $
*
*
* Portions Copyright (c) 1999-2003, PostgreSQL Global Development Group
#include "postgres.h"
#include <ctype.h>
-#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include <float.h>
*/
typedef struct TmToChar
{
- struct tm tm; /* classic 'tm' struct */
+ struct pg_tm tm; /* classic 'tm' struct */
fsec_t fsec; /* fractional seconds */
char *tzn; /* timezone */
} TmToChar;
static int dch_time(int arg, char *inout, int suf, int flag, FormatNode *node, void *data);
static int dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data);
static void do_to_timestamp(text *date_txt, text *fmt,
- struct tm *tm, fsec_t *fsec);
+ struct pg_tm *tm, fsec_t *fsec);
static char *fill_str(char *str, int c, int max);
static FormatNode *NUM_cache(int len, NUMDesc *Num, char *pars_str, bool *shouldFree);
static char *int_to_roman(int number);
dch_time(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
{
char *p_inout = inout;
- struct tm *tm = NULL;
+ struct pg_tm *tm = NULL;
TmFromChar *tmfc = NULL;
TmToChar *tmtc = NULL;
*p_inout;
int i,
len;
- struct tm *tm = NULL;
+ struct pg_tm *tm = NULL;
TmFromChar *tmfc = NULL;
TmToChar *tmtc = NULL;
datetime_to_char_body(TmToChar *tmtc, text *fmt)
{
FormatNode *format;
- struct tm *tm = NULL;
+ struct pg_tm *tm = NULL;
char *fmt_str,
*result;
bool incache;
text *fmt = PG_GETARG_TEXT_P(1);
Timestamp result;
int tz;
- struct tm tm;
+ struct pg_tm tm;
fsec_t fsec;
do_to_timestamp(date_txt, fmt, &tm, &fsec);
text *date_txt = PG_GETARG_TEXT_P(0);
text *fmt = PG_GETARG_TEXT_P(1);
DateADT result;
- struct tm tm;
+ struct pg_tm tm;
fsec_t fsec;
do_to_timestamp(date_txt, fmt, &tm, &fsec);
/*
* do_to_timestamp: shared code for to_timestamp and to_date
*
- * Parse the 'date_txt' according to 'fmt', return results as a struct tm
+ * Parse the 'date_txt' according to 'fmt', return results as a struct pg_tm
* and fractional seconds.
*/
static void
do_to_timestamp(text *date_txt, text *fmt,
- struct tm *tm, fsec_t *fsec)
+ struct pg_tm *tm, fsec_t *fsec)
{
FormatNode *format;
TmFromChar tmfc;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.32 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.33 2004/05/21 05:08:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <sys/file.h>
-#include <time.h>
#include "commands/dbcommands.h"
#include "miscadmin.h"
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.120 2004/05/05 17:28:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.121 2004/05/21 05:08:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <ctype.h>
-#include <time.h>
-#include <sys/time.h>
#include <float.h>
#include <limits.h>
#include "access/xact.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
+#include "pgtime.h"
#include "utils/builtins.h"
* Function prototypes -- internal to this file only
*/
-static AbsoluteTime tm2abstime(struct tm * tm, int tz);
-static void reltime2tm(RelativeTime time, struct tm * tm);
+static AbsoluteTime tm2abstime(struct pg_tm * tm, int tz);
+static void reltime2tm(RelativeTime time, struct pg_tm * tm);
static int istinterval(char *i_string,
AbsoluteTime *i_start,
AbsoluteTime *i_end);
/*
* GetCurrentDateTime()
*
- * Get the transaction start time ("now()") broken down as a struct tm.
+ * Get the transaction start time ("now()") broken down as a struct pg_tm.
*/
void
-GetCurrentDateTime(struct tm * tm)
+GetCurrentDateTime(struct pg_tm * tm)
{
int tz;
/*
* GetCurrentTimeUsec()
*
- * Get the transaction start time ("now()") broken down as a struct tm,
+ * Get the transaction start time ("now()") broken down as a struct pg_tm,
* including fractional seconds and timezone offset.
*/
void
-GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec, int *tzp)
+GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp)
{
int tz;
int usec;
void
-abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
+abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn)
{
time_t time = (time_t) _time;
- struct tm *tx;
+ struct pg_tm *tx;
/*
* If HasCTZSet is true then we have a brute force time zone
time -= CTimeZone;
if ((!HasCTZSet) && (tzp != NULL))
- tx = localtime(&time);
+ tx = pg_localtime(&time);
else
- tx = gmtime(&time);
+ tx = pg_gmtime(&time);
tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1;
tm->tm_sec = tx->tm_sec;
tm->tm_isdst = tx->tm_isdst;
-#if defined(HAVE_TM_ZONE)
tm->tm_gmtoff = tx->tm_gmtoff;
tm->tm_zone = tx->tm_zone;
}
else
tm->tm_isdst = -1;
-#elif defined(HAVE_INT_TIMEZONE)
- if (tzp != NULL)
- {
- /*
- * We have a brute force time zone per SQL99? Then use it without
- * change since we have already rotated to the time zone.
- */
- if (HasCTZSet)
- {
- *tzp = CTimeZone;
- tm->tm_isdst = 0;
- if (tzn != NULL)
- *tzn = NULL;
- }
- else
- {
- *tzp = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
-
- if (tzn != NULL)
- {
- /*
- * Copy no more than MAXTZLEN bytes of timezone to tzn, in
- * case it contains an error message, which doesn't fit in
- * the buffer
- */
- StrNCpy(*tzn, tzname[tm->tm_isdst], MAXTZLEN + 1);
- if (strlen(tzname[tm->tm_isdst]) > MAXTZLEN)
- ereport(WARNING,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("invalid time zone name: \"%s\"",
- tzname[tm->tm_isdst])));
- }
- }
- }
- else
- tm->tm_isdst = -1;
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
- if (tzp != NULL)
- {
- /*
- * We have a brute force time zone per SQL99? Then use it without
- * change since we have already rotated to the time zone.
- */
- if (HasCTZSet)
- {
- *tzp = CTimeZone;
- if (tzn != NULL)
- *tzn = NULL;
- }
- else
- {
- /* default to UTC */
- *tzp = 0;
- if (tzn != NULL)
- *tzn = NULL;
- }
- }
- else
- tm->tm_isdst = -1;
-#endif
}
* Note that tm has full year (not 1900-based) and 1-based month.
*/
static AbsoluteTime
-tm2abstime(struct tm * tm, int tz)
+tm2abstime(struct pg_tm * tm, int tz)
{
int day;
AbsoluteTime sec;
AbsoluteTime result;
fsec_t fsec;
int tz = 0;
- struct tm date,
+ struct pg_tm date,
*tm = &date;
int dterr;
char *field[MAXDATEFIELDS];
char *result;
int tz;
double fsec = 0;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
char buf[MAXDATELEN + 1];
char zone[MAXDATELEN + 1],
AbsoluteTime result;
fsec_t fsec;
int tz;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
if (TIMESTAMP_IS_NOBEGIN(timestamp))
{
AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
Timestamp result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
char zone[MAXDATELEN + 1],
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
AbsoluteTime result;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
if (TIMESTAMP_IS_NOBEGIN(timestamp))
{
AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
TimestampTz result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
char zone[MAXDATELEN + 1],
{
char *str = PG_GETARG_CSTRING(0);
RelativeTime result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
int dtype;
{
RelativeTime time = PG_GETARG_RELATIVETIME(0);
char *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
char buf[MAXDATELEN + 1];
static void
-reltime2tm(RelativeTime time, struct tm * tm)
+reltime2tm(RelativeTime time, struct pg_tm * tm)
{
double dtime = time;
gettimeofday(&tp, &tpz);
tt = (time_t) tp.tv_sec;
- strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z",
- localtime(&tt));
+ pg_strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z",
+ pg_localtime(&tt));
snprintf(buf, sizeof(buf), templ, tp.tv_usec);
len = VARHDRSZ + strlen(buf);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.105 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.106 2004/05/21 05:08:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int32 typmod = PG_GETARG_INT32(2);
Timestamp result;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
int dtype;
{
Timestamp timestamp = PG_GETARG_TIMESTAMP(0);
char *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
char *tzn = NULL;
int32 typmod = PG_GETARG_INT32(2);
TimestampTz result;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int tz;
int dtype;
TimestampTz dt = PG_GETARG_TIMESTAMPTZ(0);
char *result;
int tz;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
char *tzn;
int32 typmod = PG_GETARG_INT32(2);
Interval *result;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
int dtype;
int nf;
{
Interval *span = PG_GETARG_INTERVAL_P(0);
char *result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
char buf[MAXDATELEN + 1];
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
*/
int
-timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
+timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, char **tzn)
{
#ifdef HAVE_INT64_TIMESTAMP
int date,
date0;
int64 time;
-
#else
double date,
date0;
double time;
#endif
time_t utime;
-
-#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
- struct tm *tx;
-#endif
+ struct pg_tm *tx;
date0 = POSTGRES_EPOCH_JDATE;
{
*tzp = CTimeZone;
tm->tm_isdst = 0;
-#if defined(HAVE_TM_ZONE)
tm->tm_gmtoff = CTimeZone;
tm->tm_zone = NULL;
-#endif
if (tzn != NULL)
*tzn = NULL;
}
utime = (dt + ((date0 - UNIX_EPOCH_JDATE) * 86400));
#endif
-#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
- tx = localtime(&utime);
+ tx = pg_localtime(&utime);
tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1;
tm->tm_mday = tx->tm_mday;
tm->tm_hour = tx->tm_hour;
tm->tm_min = tx->tm_min;
-#if NOT_USED
-/* XXX HACK
- * Argh! My Linux box puts in a 1 second offset for dates less than 1970
- * but only if the seconds field was non-zero. So, don't copy the seconds
- * field and instead carry forward from the original - thomas 97/06/18
- * Note that Linux uses the standard freeware zic package as do
- * many other platforms so this may not be Linux/ix86-specific.
- * Still shows a problem on my up to date Linux box - thomas 2001-01-17
- */
tm->tm_sec = tx->tm_sec;
-#endif
tm->tm_isdst = tx->tm_isdst;
-
-#if defined(HAVE_TM_ZONE)
tm->tm_gmtoff = tx->tm_gmtoff;
tm->tm_zone = tx->tm_zone;
- *tzp = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
+ *tzp = -(tm->tm_gmtoff);
if (tzn != NULL)
*tzn = (char *) tm->tm_zone;
-#elif defined(HAVE_INT_TIMEZONE)
- *tzp = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
- if (tzn != NULL)
- *tzn = tzname[(tm->tm_isdst > 0)];
-#endif
-
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
- *tzp = 0;
- /* Mark this as *no* time zone available */
- tm->tm_isdst = -1;
- if (tzn != NULL)
- *tzn = NULL;
-#endif
}
else
{
* Returns -1 on failure (value out of range).
*/
int
-tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
+tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
{
#ifdef HAVE_INT64_TIMESTAMP
int date;
int64 time;
-
#else
double date,
time;
* Convert a interval data type to a tm structure.
*/
int
-interval2tm(Interval span, struct tm * tm, fsec_t *fsec)
+interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
{
#ifdef HAVE_INT64_TIMESTAMP
int64 time;
-
#else
double time;
#endif
}
int
-tm2interval(struct tm * tm, fsec_t fsec, Interval *span)
+tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span)
{
span->month = ((tm->tm_year * 12) + tm->tm_mon);
#ifdef HAVE_INT64_TIMESTAMP
*---------------------------------------------------------*/
void
-GetEpochTime(struct tm * tm)
+GetEpochTime(struct pg_tm * tm)
{
- struct tm *t0;
+ struct pg_tm *t0;
time_t epoch = 0;
- t0 = gmtime(&epoch);
+ t0 = pg_gmtime(&epoch);
tm->tm_year = t0->tm_year;
tm->tm_mon = t0->tm_mon;
SetEpochTimestamp(void)
{
Timestamp dt;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
GetEpochTime(tm);
{
if (span->month != 0)
{
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
{
if (span->month != 0)
{
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
fsec_t fsec,
fsec1,
fsec2;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
- struct tm tt1,
+ struct pg_tm tt1,
*tm1 = &tt1;
- struct tm tt2,
+ struct pg_tm tt2,
*tm2 = &tt2;
result = (Interval *) palloc(sizeof(Interval));
fsec_t fsec,
fsec1,
fsec2;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
- struct tm tt1,
+ struct pg_tm tt1,
*tm1 = &tt1;
- struct tm tt2,
+ struct pg_tm tt2,
*tm2 = &tt2;
result = (Interval *) palloc(sizeof(Interval));
val;
char *lowunits;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
if (TIMESTAMP_NOT_FINITE(timestamp))
char *lowunits;
fsec_t fsec;
char *tzn;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
if (TIMESTAMP_NOT_FINITE(timestamp))
val;
char *lowunits;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
result = (Interval *) palloc(sizeof(Interval));
val;
char *lowunits;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
if (TIMESTAMP_NOT_FINITE(timestamp))
double dummy;
fsec_t fsec;
char *tzn;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
if (TIMESTAMP_NOT_FINITE(timestamp))
val;
char *lowunits;
fsec_t fsec;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
lowunits = downcase_truncate_identifier(VARDATA(units),
timestamp2timestamptz(Timestamp timestamp)
{
TimestampTz result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
int tz;
{
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(0);
Timestamp result;
- struct tm tt,
+ struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
char *tzn;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.136 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.137 2004/05/21 05:08:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include <time.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
-#include <sys/time.h>
#include <ctype.h>
#ifdef HAVE_SYSLOG
#include <syslog.h>
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
+#include "pgtime.h"
#include "storage/ipc.h"
#include "tcop/tcopprot.h"
#include "utils/memutils.h"
time_t stamp_time = time(NULL);
char strfbuf[128];
- strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z",
- localtime(&stamp_time));
+ pg_strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z",
+ pg_localtime(&stamp_time));
appendStringInfoString(buf, strfbuf);
}
break;
time_t stamp_time = MyProcPort->session_start.tv_sec;
char strfbuf[128];
- strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z",
- localtime(&stamp_time));
+ pg_strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z",
+ pg_localtime(&stamp_time));
appendStringInfoString(buf, strfbuf);
}
break;
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.205 2004/05/08 02:11:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.206 2004/05/21 05:08:03 tgl Exp $
*
*--------------------------------------------------------------------
*/
if (env != NULL)
SetConfigOption("datestyle", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
- env = getenv("TZ");
- if (env != NULL)
- SetConfigOption("timezone", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
-
env = getenv("PGCLIENTENCODING");
if (env != NULL)
SetConfigOption("client_encoding", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.164 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.165 2004/05/21 05:08:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#define HAVE_INT64_TIMESTAMP
#endif
-/* Global variable holding time zone information. */
-#if defined(USE_PGTZ) && !defined(FRONTEND)
-#define TIMEZONE_GLOBAL pg_timezone
-#else
-#ifndef HAVE_UNDERSCORE_TIMEZONE
-#define TIMEZONE_GLOBAL timezone
-#else
-#define TIMEZONE_GLOBAL _timezone
-#define tzname _tzname /* should be in time.h? */
-#endif
-#endif
-
/* sig_atomic_t is required by ANSI C, but may be missing on old platforms */
#ifndef HAVE_SIG_ATOMIC_T
typedef int sig_atomic_t;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.13 2004/02/11 22:55:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.14 2004/05/21 05:08:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PG_CONTROL_H
#define PG_CONTROL_H
-#include <time.h>
-
#include "access/xlogdefs.h"
+#include "pgtime.h"
#include "utils/pg_crc.h"
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/vacuum.h,v 1.51 2004/02/15 21:01:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/vacuum.h,v 1.52 2004/05/21 05:08:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef VACUUM_H
#define VACUUM_H
-#include <time.h>
-#include <sys/time.h>
-
#ifdef HAVE_GETRUSAGE
#include <sys/resource.h>
#else
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
#include "nodes/parsenodes.h"
+#include "pgtime.h"
#include "utils/rel.h"
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.44 2004/04/05 03:16:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.45 2004/05/21 05:08:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LIBPQ_BE_H
#define LIBPQ_BE_H
-#ifndef _MSC_VER
#include <sys/time.h>
-#endif
+
#ifdef USE_SSL
#include <openssl/ssl.h>
#include <openssl/err.h>
/* Define to 1 to build with PAM support. (--with-pam) */
#undef USE_PAM
-/* Define to 1 to use our own timezone library */
-#undef USE_PGTZ
-
/* Define to 1 to build with Rendezvous support. (--with-rendezvous) */
#undef USE_RENDEZVOUS
* for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted).
*
- * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.12 2004/03/24 22:40:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.13 2004/05/21 05:08:03 tgl Exp $
*------------------------------------------------------------------------
*/
#define HAVE_WORKING_LINK 1
#endif
-/*
- * Define this if your operating system has _timezone rather than timezone
- */
-#if defined(__CYGWIN__) || defined(WIN32)
-#define HAVE_INT_TIMEZONE /* has int _timezone */
-#define HAVE_UNDERSCORE_TIMEZONE 1
-#endif
-
/*
* This is the default directory in which AF_UNIX socket files are
* placed. Caution: changing this risks breaking your existing client
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * pgtime.h
+ * PostgreSQL internal timezone library
+ *
+ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * $PostgreSQL: pgsql/src/include/pgtime.h,v 1.1 2004/05/21 05:08:03 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _PGTIME_H
+#define _PGTIME_H
+
+#ifdef FRONTEND
+
+/* Don't mess with anything for the frontends */
+#include <time.h>
+
+#else
+
+/*
+ * Redefine functions and defines we implement, so we cause an
+ * error if someone tries to use the "base functions"
+ */
+#ifndef NO_REDEFINE_TIMEFUNCS
+#define localtime DONOTUSETHIS_localtime
+#define gmtime DONOTUSETHIS_gmtime
+#define asctime DONOTUSETHIS_asctime
+#define ctime DONOTUSETHIS_ctime
+#define tzset DONOTUSETHIS_tzset
+#define mktime DONOTUSETHIS_mktime
+#define tzname DONOTUSETHIS_tzname
+#define daylight DONOTUSETHIS_daylight
+#define strftime DONOTUSETHIS_strftime
+#endif
+
+/* Then pull in default declarations, particularly time_t */
+#include <time.h>
+
+/*
+ * Now define prototype for our own timezone implementation
+ * structs and functions.
+ */
+struct pg_tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+ long int tm_gmtoff;
+ const char *tm_zone;
+};
+
+extern struct pg_tm *pg_localtime(const time_t *);
+extern struct pg_tm *pg_gmtime(const time_t *);
+extern time_t pg_mktime(struct pg_tm *);
+extern bool pg_tzset(const char *tzname);
+extern size_t pg_strftime(char *s, size_t max, const char *format,
+ const struct pg_tm *tm);
+extern void pg_timezone_initialize(void);
+extern bool tz_acceptable(void);
+extern const char *select_default_timezone(void);
+extern const char *pg_get_current_timezone(void);
+
+#endif /* FRONTEND */
+
+#endif /* _PGTIME_H */
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/port.h,v 1.35 2004/05/20 15:38:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.36 2004/05/21 05:08:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
#define WTERMSIG(w) ((w) & 0x7f)
#endif
-
-/*
- * Internal timezone library
- */
-#ifdef USE_PGTZ
-#ifndef FRONTEND
-#undef localtime
-#undef gmtime
-#undef asctime
-#undef ctime
-#undef difftime
-#undef mktime
-#undef tzset
-
-#define localtime(timep) pg_localtime(timep)
-#define gmtime(timep) pg_gmtime(timep)
-#define asctime(timep) pg_asctime(timep)
-#define ctime(timep) pg_ctime(timep)
-#define difftime(t1,t2) pg_difftime(t1,t2)
-#define mktime(tm) pg_mktime(tm)
-#define tzset pg_tzset
-
-
-extern struct tm *pg_localtime(const time_t *);
-extern struct tm *pg_gmtime(const time_t *);
-extern char *pg_asctime(const struct tm *);
-extern char *pg_ctime(const time_t *);
-extern double pg_difftime(const time_t, const time_t);
-extern time_t pg_mktime(struct tm *);
-extern void pg_tzset(void);
-extern time_t pg_timezone;
-
-#endif
-#endif
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.47 2004/01/19 19:04:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.48 2004/05/21 05:08:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <limits.h>
#include <math.h>
-#include <time.h>
+#include "pgtime.h"
#include "utils/timestamp.h"
#define DTERR_TZDISP_OVERFLOW (-5)
-extern void GetCurrentDateTime(struct tm * tm);
-extern void GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec, int *tzp);
+extern void GetCurrentDateTime(struct pg_tm * tm);
+extern void GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp);
extern void j2date(int jd, int *year, int *month, int *day);
extern int date2j(int year, int month, int day);
int maxfields, int *numfields);
extern int DecodeDateTime(char **field, int *ftype,
int nf, int *dtype,
- struct tm * tm, fsec_t *fsec, int *tzp);
+ struct pg_tm * tm, fsec_t *fsec, int *tzp);
extern int DecodeTimeOnly(char **field, int *ftype,
int nf, int *dtype,
- struct tm * tm, fsec_t *fsec, int *tzp);
+ struct pg_tm * tm, fsec_t *fsec, int *tzp);
extern int DecodeInterval(char **field, int *ftype,
int nf, int *dtype,
- struct tm * tm, fsec_t *fsec);
+ struct pg_tm * tm, fsec_t *fsec);
extern void DateTimeParseError(int dterr, const char *str,
const char *datatype);
-extern int DetermineLocalTimeZone(struct tm * tm);
+extern int DetermineLocalTimeZone(struct pg_tm * tm);
-extern int EncodeDateOnly(struct tm * tm, int style, char *str);
-extern int EncodeTimeOnly(struct tm * tm, fsec_t fsec, int *tzp, int style, char *str);
-extern int EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str);
-extern int EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str);
+extern int EncodeDateOnly(struct pg_tm * tm, int style, char *str);
+extern int EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str);
+extern int EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str);
+extern int EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str);
extern int DecodeSpecial(int field, char *lowtoken, int *val);
extern int DecodeUnits(int field, char *lowtoken, int *val);
extern int j2day(int jd);
-extern int DecodePosixTimezone(char *str, int *tzp);
-
extern bool CheckDateTokenTables(void);
#endif /* DATETIME_H */
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/nabstime.h,v 1.41 2003/11/29 22:41:15 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/utils/nabstime.h,v 1.42 2004/05/21 05:08:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#define NABSTIME_H
#include <limits.h>
-#include <time.h>
#include "fmgr.h"
+#include "pgtime.h"
#include "utils/timestamp.h"
#include "utils/datetime.h"
extern AbsoluteTime GetCurrentAbsoluteTime(void);
extern AbsoluteTime GetCurrentAbsoluteTimeUsec(int *usec);
extern TimestampTz AbsoluteTimeUsecToTimestampTz(AbsoluteTime sec, int usec);
-extern void abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char **tzn);
+extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm * tm, char **tzn);
#endif /* NABSTIME_H */
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.36 2004/05/01 19:25:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.37 2004/05/21 05:08:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
-#include <time.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include "fmgr.h"
+#include "pgtime.h"
#ifdef HAVE_INT64_TIMESTAMP
#include "utils/int8.h"
#endif
/* Internal routines (not fmgr-callable) */
-extern int tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, Timestamp *dt);
-extern int timestamp2tm(Timestamp dt, int *tzp, struct tm * tm,
+extern int tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *dt);
+extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm,
fsec_t *fsec, char **tzn);
extern void dt2time(Timestamp dt, int *hour, int *min, int *sec, fsec_t *fsec);
-extern int interval2tm(Interval span, struct tm * tm, fsec_t *fsec);
-extern int tm2interval(struct tm * tm, fsec_t fsec, Interval *span);
+extern int interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec);
+extern int tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span);
extern Timestamp SetEpochTimestamp(void);
-extern void GetEpochTime(struct tm * tm);
+extern void GetEpochTime(struct pg_tm * tm);
extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2);
/* timestamp comparison works for timestamptz also */
/*
- * $PostgreSQL: pgsql/src/port/gettimeofday.c,v 1.3 2003/11/29 19:52:13 pgsql Exp $
+ * $PostgreSQL: pgsql/src/port/gettimeofday.c,v 1.4 2004/05/21 05:08:05 tgl Exp $
*
* Copyright (c) 2003 SRA, Inc.
* Copyright (c) 2003 SKC, Inc.
#include "postgres.h"
-#include "sys/time.h"
+#include <sys/time.h>
+
/* FILETIME of Jan 1 1970 00:00:00. */
static const unsigned __int64 epoch = 116444736000000000L;
+++ /dev/null
---
--- ABSTIME
--- testing built-in time type abstime
--- uses reltime and tinterval
---
---
--- timezones may vary based not only on location but the operating
--- system. the main correctness issue is that the OS may not get
--- daylight savings time right for times prior to Unix epoch (jan 1 1970).
---
-CREATE TABLE ABSTIME_TBL (f1 abstime);
-BEGIN;
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now');
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now');
-SELECT count(*) AS two FROM ABSTIME_TBL WHERE f1 = 'now' ;
- two
------
- 2
-(1 row)
-
-END;
-DELETE FROM ABSTIME_TBL;
-INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21');
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'Mon May 1 00:30:30 1995');
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'epoch');
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'infinity');
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime '-infinity');
-INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12');
--- what happens if we specify slightly misformatted abstime?
-INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00');
-ERROR: date/time field value out of range: "Feb 35, 1946 10:00:00"
-HINT: Perhaps you need a different "datestyle" setting.
-INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10');
-ERROR: date/time field value out of range: "Feb 28, 1984 25:08:10"
--- badly formatted abstimes: these should result in invalid abstimes
-INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
-ERROR: invalid input syntax for type abstime: "bad date format"
-INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843');
--- test abstime operators
-SELECT '' AS eight, ABSTIME_TBL.*;
- eight | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
- | infinity
- | -infinity
- | Sat May 10 23:59:12 1947 PDT
- | invalid
-(7 rows)
-
-SELECT '' AS six, ABSTIME_TBL.*
- WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001';
- six | f1
------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
- | -infinity
- | Sat May 10 23:59:12 1947 PDT
-(5 rows)
-
-SELECT '' AS six, ABSTIME_TBL.*
- WHERE ABSTIME_TBL.f1 > abstime '-infinity';
- six | f1
------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
- | infinity
- | Sat May 10 23:59:12 1947 PDT
- | invalid
-(6 rows)
-
-SELECT '' AS six, ABSTIME_TBL.*
- WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1;
- six | f1
------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
- | infinity
- | -infinity
- | invalid
-(6 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE abstime 'epoch' >= ABSTIME_TBL.f1;
- three | f1
--------+------------------------------
- | Wed Dec 31 16:00:00 1969 PST
- | -infinity
- | Sat May 10 23:59:12 1947 PDT
-(3 rows)
-
-SELECT '' AS four, ABSTIME_TBL.*
- WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21';
- four | f1
-------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | -infinity
- | Sat May 10 23:59:12 1947 PDT
-(4 rows)
-
-SELECT '' AS four, ABSTIME_TBL.*
- WHERE ABSTIME_TBL.f1 <?>
- tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]';
- four | f1
-------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
-(3 rows)
-
-SELECT '' AS four, f1 AS abstime,
- date_part('year', f1) AS year, date_part('month', f1) AS month,
- date_part('day',f1) AS day, date_part('hour', f1) AS hour,
- date_part('minute', f1) AS minute, date_part('second', f1) AS second
- FROM ABSTIME_TBL
- WHERE isfinite(f1)
- ORDER BY abstime;
- four | abstime | year | month | day | hour | minute | second
-------+------------------------------+------+-------+-----+------+--------+--------
- | Sat May 10 23:59:12 1947 PDT | 1947 | 5 | 10 | 23 | 59 | 12
- | Wed Dec 31 16:00:00 1969 PST | 1969 | 12 | 31 | 16 | 0 | 0
- | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21
- | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30
-(4 rows)
-
+++ /dev/null
---
--- HOROLOGY
---
--- needed so tests pass even in Australia
-SET australian_timezones = 'off';
-SET DateStyle = 'Postgres, MDY';
---
--- Test various input formats
---
-SELECT timestamp with time zone '20011227 040506+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227 040506-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227 040506.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227 040506.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '2001-12-27 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '2001.12.27 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '2001/12/27 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '12/27/2001 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
--- should fail in mdy mode:
-SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
-ERROR: date/time field value out of range: "27/12/2001 04:05:06.789-08"
-HINT: Perhaps you need a different "datestyle" setting.
-set datestyle to dmy;
-SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu 27 Dec 04:05:06.789 2001 PST
-(1 row)
-
-reset datestyle;
-SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271+08';
- timestamptz
-------------------------------
- Wed Dec 26 08:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271-08';
- timestamptz
-------------------------------
- Thu Dec 27 00:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271.5+08';
- timestamptz
-------------------------------
- Wed Dec 26 20:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271.5-08';
- timestamptz
-------------------------------
- Thu Dec 27 12:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271 04:05:06+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271 04:05:06-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
--- German/European-style dates with periods as delimiters
-SELECT timestamp with time zone '12.27.2001 04:05:06.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '12.27.2001 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SET DateStyle = 'German';
-SELECT timestamp with time zone '27.12.2001 04:05:06.789+08';
- timestamptz
------------------------------
- 26.12.2001 12:05:06.789 PST
-(1 row)
-
-SELECT timestamp with time zone '27.12.2001 04:05:06.789-08';
- timestamptz
------------------------------
- 27.12.2001 04:05:06.789 PST
-(1 row)
-
-SET DateStyle = 'ISO';
--- As of 7.4, allow time without time zone having a time zone specified
-SELECT time without time zone '040506.789+08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time without time zone '040506.789-08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time without time zone 'T040506.789+08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time without time zone 'T040506.789-08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time with time zone '040506.789+08';
- timetz
-------------------
- 04:05:06.7890+08
-(1 row)
-
-SELECT time with time zone '040506.789-08';
- timetz
-------------------
- 04:05:06.7890-08
-(1 row)
-
-SELECT time with time zone 'T040506.789+08';
- timetz
-------------------
- 04:05:06.7890+08
-(1 row)
-
-SELECT time with time zone 'T040506.789-08';
- timetz
-------------------
- 04:05:06.7890-08
-(1 row)
-
-SELECT time with time zone 'T040506.789 +08';
- timetz
-------------------
- 04:05:06.7890+08
-(1 row)
-
-SELECT time with time zone 'T040506.789 -08';
- timetz
-------------------
- 04:05:06.7890-08
-(1 row)
-
-SET DateStyle = 'Postgres, MDY';
---
--- date, time arithmetic
---
-SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
- Date + Time
---------------------------
- Tue Feb 03 04:05:06 1981
-(1 row)
-
-SELECT date '1991-02-03' + time with time zone '04:05:06 PST' AS "Date + Time PST";
- Date + Time PST
-------------------------------
- Sun Feb 03 04:05:06 1991 PST
-(1 row)
-
-SELECT date '2001-02-03' + time with time zone '04:05:06 UTC' AS "Date + Time UTC";
- Date + Time UTC
-------------------------------
- Fri Feb 02 20:05:06 2001 PST
-(1 row)
-
-SELECT date '1991-02-03' + interval '2 years' AS "Add Two Years";
- Add Two Years
---------------------------
- Wed Feb 03 00:00:00 1993
-(1 row)
-
-SELECT date '2001-12-13' - interval '2 years' AS "Subtract Two Years";
- Subtract Two Years
---------------------------
- Mon Dec 13 00:00:00 1999
-(1 row)
-
--- subtract time from date should not make sense; use interval instead
-SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
- Subtract Time
---------------------------
- Sat Feb 02 19:54:54 1991
-(1 row)
-
-SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
-ERROR: operator does not exist: date - time with time zone
-HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
---
--- timestamp, interval arithmetic
---
-SELECT timestamp without time zone '1996-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
---------------------------
- Thu Feb 29 23:59:59 1996
-(1 row)
-
-SELECT timestamp without time zone '1999-03-01' - interval '1 second' AS "Feb 28";
- Feb 28
---------------------------
- Sun Feb 28 23:59:59 1999
-(1 row)
-
-SELECT timestamp without time zone '2000-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
---------------------------
- Tue Feb 29 23:59:59 2000
-(1 row)
-
-SELECT timestamp without time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31";
- Dec 31
---------------------------
- Fri Dec 31 23:59:59 1999
-(1 row)
-
-SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' AS "Feb 23, 285506";
- Feb 23, 285506
-----------------------------
- Fri Feb 23 00:00:00 285506
-(1 row)
-
-SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244";
- Jan 20, 288244
-----------------------------
- Sat Jan 20 00:00:00 288244
-(1 row)
-
-SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276";
- Dec 31, 294276
-----------------------------
- Sun Dec 31 00:00:00 294276
-(1 row)
-
-SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
- 106751991 Days
-------------------
- @ 106751991 days
-(1 row)
-
--- Shorthand values
--- Not directly usable for regression testing since these are not constants.
--- So, just try to test parser and hope for the best - thomas 97/04/26
-SELECT (timestamp without time zone 'today' = (timestamp without time zone 'yesterday' + interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone 'today' = (timestamp without time zone 'tomorrow' - interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone 'tomorrow' = (timestamp without time zone 'yesterday' + interval '2 days')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone 'tomorrow' > 'now') as "True";
- True
-------
- t
-(1 row)
-
--- Convert from date and time to timestamp
--- This test used to be timestamp(date,time) but no longer allowed by grammar
--- to enable support for SQL99 timestamp type syntax.
-SELECT date '1994-01-01' + time '11:00' AS "Jan_01_1994_11am";
- Jan_01_1994_11am
---------------------------
- Sat Jan 01 11:00:00 1994
-(1 row)
-
-SELECT date '1994-01-01' + time '10:00' AS "Jan_01_1994_10am";
- Jan_01_1994_10am
---------------------------
- Sat Jan 01 10:00:00 1994
-(1 row)
-
-SELECT date '1994-01-01' + timetz '11:00-5' AS "Jan_01_1994_8am";
- Jan_01_1994_8am
-------------------------------
- Sat Jan 01 08:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am";
- Jan_01_1994_8am
-------------------------------
- Sat Jan 01 08:00:00 1994 PST
-(1 row)
-
-SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL;
- 64 | one_year
-----+-----------------------------
- | -infinity
- | infinity
- | Fri Jan 01 00:00:00 1971
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:02 1998
- | Tue Feb 10 17:32:01.40 1998
- | Tue Feb 10 17:32:01.50 1998
- | Tue Feb 10 17:32:01.60 1998
- | Fri Jan 02 00:00:00 1998
- | Fri Jan 02 03:04:05 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Wed Jun 10 17:32:01 1998
- | Sun Sep 22 18:19:20 2002
- | Thu Mar 15 08:14:01 2001
- | Thu Mar 15 13:14:02 2001
- | Thu Mar 15 12:14:03 2001
- | Thu Mar 15 03:14:04 2001
- | Thu Mar 15 02:14:05 2001
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:00 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Wed Jun 10 18:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Wed Feb 11 17:32:01 1998
- | Thu Feb 12 17:32:01 1998
- | Fri Feb 13 17:32:01 1998
- | Sat Feb 14 17:32:01 1998
- | Sun Feb 15 17:32:01 1998
- | Mon Feb 16 17:32:01 1998
- | Thu Feb 16 17:32:01 0096 BC
- | Sun Feb 16 17:32:01 0098
- | Fri Feb 16 17:32:01 0598
- | Wed Feb 16 17:32:01 1098
- | Sun Feb 16 17:32:01 1698
- | Fri Feb 16 17:32:01 1798
- | Wed Feb 16 17:32:01 1898
- | Mon Feb 16 17:32:01 1998
- | Sun Feb 16 17:32:01 2098
- | Fri Feb 28 17:32:01 1997
- | Fri Feb 28 17:32:01 1997
- | Sat Mar 01 17:32:01 1997
- | Tue Dec 30 17:32:01 1997
- | Wed Dec 31 17:32:01 1997
- | Thu Jan 01 17:32:01 1998
- | Sat Feb 28 17:32:01 1998
- | Sun Mar 01 17:32:01 1998
- | Wed Dec 30 17:32:01 1998
- | Thu Dec 31 17:32:01 1998
- | Sun Dec 31 17:32:01 2000
- | Mon Jan 01 17:32:01 2001
- | Mon Dec 31 17:32:01 2001
- | Tue Jan 01 17:32:01 2002
-(64 rows)
-
-SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL;
- 64 | one_year
-----+-----------------------------
- | -infinity
- | infinity
- | Wed Jan 01 00:00:00 1969
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:02 1996
- | Sat Feb 10 17:32:01.40 1996
- | Sat Feb 10 17:32:01.50 1996
- | Sat Feb 10 17:32:01.60 1996
- | Tue Jan 02 00:00:00 1996
- | Tue Jan 02 03:04:05 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Mon Jun 10 17:32:01 1996
- | Fri Sep 22 18:19:20 2000
- | Mon Mar 15 08:14:01 1999
- | Mon Mar 15 13:14:02 1999
- | Mon Mar 15 12:14:03 1999
- | Mon Mar 15 03:14:04 1999
- | Mon Mar 15 02:14:05 1999
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:00 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Mon Jun 10 18:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sun Feb 11 17:32:01 1996
- | Mon Feb 12 17:32:01 1996
- | Tue Feb 13 17:32:01 1996
- | Wed Feb 14 17:32:01 1996
- | Thu Feb 15 17:32:01 1996
- | Fri Feb 16 17:32:01 1996
- | Mon Feb 16 17:32:01 0098 BC
- | Thu Feb 16 17:32:01 0096
- | Tue Feb 16 17:32:01 0596
- | Sun Feb 16 17:32:01 1096
- | Thu Feb 16 17:32:01 1696
- | Tue Feb 16 17:32:01 1796
- | Sun Feb 16 17:32:01 1896
- | Fri Feb 16 17:32:01 1996
- | Thu Feb 16 17:32:01 2096
- | Tue Feb 28 17:32:01 1995
- | Tue Feb 28 17:32:01 1995
- | Wed Mar 01 17:32:01 1995
- | Sat Dec 30 17:32:01 1995
- | Sun Dec 31 17:32:01 1995
- | Mon Jan 01 17:32:01 1996
- | Wed Feb 28 17:32:01 1996
- | Fri Mar 01 17:32:01 1996
- | Mon Dec 30 17:32:01 1996
- | Tue Dec 31 17:32:01 1996
- | Thu Dec 31 17:32:01 1998
- | Fri Jan 01 17:32:01 1999
- | Fri Dec 31 17:32:01 1999
- | Sat Jan 01 17:32:01 2000
-(64 rows)
-
-SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
-------------------------------
- Thu Feb 29 23:59:59 1996 PST
-(1 row)
-
-SELECT timestamp with time zone '1999-03-01' - interval '1 second' AS "Feb 28";
- Feb 28
-------------------------------
- Sun Feb 28 23:59:59 1999 PST
-(1 row)
-
-SELECT timestamp with time zone '2000-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
-------------------------------
- Tue Feb 29 23:59:59 2000 PST
-(1 row)
-
-SELECT timestamp with time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31";
- Dec 31
-------------------------------
- Fri Dec 31 23:59:59 1999 PST
-(1 row)
-
-SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone 'today' = (timestamp with time zone 'tomorrow' - interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone 'tomorrow' = (timestamp with time zone 'yesterday' + interval '2 days')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone 'tomorrow' > 'now') as "True";
- True
-------
- t
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time '11:00') AS "Jan_01_1994_10am";
- Jan_01_1994_10am
-------------------------------
- Sat Jan 01 11:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time '10:00') AS "Jan_01_1994_9am";
- Jan_01_1994_9am
-------------------------------
- Sat Jan 01 10:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '11:00-8') AS "Jan_01_1994_11am";
- Jan_01_1994_11am
-------------------------------
- Sat Jan 01 11:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '10:00-8') AS "Jan_01_1994_10am";
- Jan_01_1994_10am
-------------------------------
- Sat Jan 01 10:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am";
- Jan_01_1994_8am
-------------------------------
- Sat Jan 01 08:00:00 1994 PST
-(1 row)
-
-SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
- 64 | one_year
-----+---------------------------------
- | -infinity
- | infinity
- | Thu Dec 31 16:00:00 1970 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:02 1998 PST
- | Tue Feb 10 17:32:01.40 1998 PST
- | Tue Feb 10 17:32:01.50 1998 PST
- | Tue Feb 10 17:32:01.60 1998 PST
- | Fri Jan 02 00:00:00 1998 PST
- | Fri Jan 02 03:04:05 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Wed Jun 10 17:32:01 1998 PDT
- | Sun Sep 22 18:19:20 2002 PDT
- | Thu Mar 15 08:14:01 2001 PST
- | Thu Mar 15 04:14:02 2001 PST
- | Thu Mar 15 02:14:03 2001 PST
- | Thu Mar 15 03:14:04 2001 PST
- | Thu Mar 15 01:14:05 2001 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:00 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 09:32:01 1998 PST
- | Tue Feb 10 09:32:01 1998 PST
- | Tue Feb 10 09:32:01 1998 PST
- | Wed Jun 10 18:32:01 1998 PDT
- | Tue Feb 10 17:32:01 1998 PST
- | Wed Feb 11 17:32:01 1998 PST
- | Thu Feb 12 17:32:01 1998 PST
- | Fri Feb 13 17:32:01 1998 PST
- | Sat Feb 14 17:32:01 1998 PST
- | Sun Feb 15 17:32:01 1998 PST
- | Mon Feb 16 17:32:01 1998 PST
- | Thu Feb 16 17:32:01 0096 BC
- | Sun Feb 16 17:32:01 0098
- | Fri Feb 16 17:32:01 0598
- | Wed Feb 16 17:32:01 1098
- | Sun Feb 16 17:32:01 1698
- | Fri Feb 16 17:32:01 1798
- | Wed Feb 16 17:32:01 1898
- | Mon Feb 16 17:32:01 1998 PST
- | Sun Feb 16 17:32:01 2098
- | Fri Feb 28 17:32:01 1997 PST
- | Fri Feb 28 17:32:01 1997 PST
- | Sat Mar 01 17:32:01 1997 PST
- | Tue Dec 30 17:32:01 1997 PST
- | Wed Dec 31 17:32:01 1997 PST
- | Thu Jan 01 17:32:01 1998 PST
- | Sat Feb 28 17:32:01 1998 PST
- | Sun Mar 01 17:32:01 1998 PST
- | Wed Dec 30 17:32:01 1998 PST
- | Thu Dec 31 17:32:01 1998 PST
- | Sun Dec 31 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST
- | Mon Dec 31 17:32:01 2001 PST
- | Tue Jan 01 17:32:01 2002 PST
-(64 rows)
-
-SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
- 64 | one_year
-----+---------------------------------
- | -infinity
- | infinity
- | Tue Dec 31 16:00:00 1968 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:02 1996 PST
- | Sat Feb 10 17:32:01.40 1996 PST
- | Sat Feb 10 17:32:01.50 1996 PST
- | Sat Feb 10 17:32:01.60 1996 PST
- | Tue Jan 02 00:00:00 1996 PST
- | Tue Jan 02 03:04:05 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Mon Jun 10 17:32:01 1996 PDT
- | Fri Sep 22 18:19:20 2000 PDT
- | Mon Mar 15 08:14:01 1999 PST
- | Mon Mar 15 04:14:02 1999 PST
- | Mon Mar 15 02:14:03 1999 PST
- | Mon Mar 15 03:14:04 1999 PST
- | Mon Mar 15 01:14:05 1999 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:00 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 09:32:01 1996 PST
- | Sat Feb 10 09:32:01 1996 PST
- | Sat Feb 10 09:32:01 1996 PST
- | Mon Jun 10 18:32:01 1996 PDT
- | Sat Feb 10 17:32:01 1996 PST
- | Sun Feb 11 17:32:01 1996 PST
- | Mon Feb 12 17:32:01 1996 PST
- | Tue Feb 13 17:32:01 1996 PST
- | Wed Feb 14 17:32:01 1996 PST
- | Thu Feb 15 17:32:01 1996 PST
- | Fri Feb 16 17:32:01 1996 PST
- | Mon Feb 16 17:32:01 0098 BC
- | Thu Feb 16 17:32:01 0096
- | Tue Feb 16 17:32:01 0596
- | Sun Feb 16 17:32:01 1096
- | Thu Feb 16 17:32:01 1696
- | Tue Feb 16 17:32:01 1796
- | Sun Feb 16 17:32:01 1896
- | Fri Feb 16 17:32:01 1996 PST
- | Thu Feb 16 17:32:01 2096
- | Tue Feb 28 17:32:01 1995 PST
- | Tue Feb 28 17:32:01 1995 PST
- | Wed Mar 01 17:32:01 1995 PST
- | Sat Dec 30 17:32:01 1995 PST
- | Sun Dec 31 17:32:01 1995 PST
- | Mon Jan 01 17:32:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST
- | Thu Dec 31 17:32:01 1998 PST
- | Fri Jan 01 17:32:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST
-(64 rows)
-
---
--- time, interval arithmetic
---
-SELECT CAST(time '01:02' AS interval) AS "+01:02";
- +01:02
------------------
- @ 1 hour 2 mins
-(1 row)
-
-SELECT CAST(interval '02:03' AS time) AS "02:03:00";
- 02:03:00
-----------
- 02:03:00
-(1 row)
-
-SELECT time '01:30' + interval '02:01' AS "03:31:00";
- 03:31:00
-----------
- 03:31:00
-(1 row)
-
-SELECT time '01:30' - interval '02:01' AS "23:29:00";
- 23:29:00
-----------
- 23:29:00
-(1 row)
-
-SELECT time '02:30' + interval '36:01' AS "14:31:00";
- 14:31:00
-----------
- 14:31:00
-(1 row)
-
-SELECT time '03:30' + interval '1 month 04:01' AS "07:31:00";
- 07:31:00
-----------
- 07:31:00
-(1 row)
-
-SELECT interval '04:30' - time '01:02' AS "20:32:00";
- 20:32:00
-----------
- 20:32:00
-(1 row)
-
-SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
-ERROR: cannot cast type time with time zone to interval
-SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
-ERROR: cannot cast type interval to time with time zone
-SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
- 23:29:00-08
--------------
- 23:29:00-08
-(1 row)
-
-SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
- 14:31:00-08
--------------
- 14:31:00-08
-(1 row)
-
--- These two tests cannot be used because they default to current timezone,
--- which may be either -08 or -07 depending on the time of year.
--- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
--- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
--- Try the following two tests instead, as a poor substitute
-SELECT CAST(CAST(date 'today' + time with time zone '01:30'
- + interval '02:01' AS time with time zone) AS time) AS "03:31:00";
- 03:31:00
-----------
- 03:31:00
-(1 row)
-
-SELECT CAST(cast(date 'today' + time with time zone '03:30'
- + interval '1 month 04:01' as timestamp without time zone) AS time) AS "07:31:00";
- 07:31:00
-----------
- 07:31:00
-(1 row)
-
-SELECT interval '04:30' - time with time zone '01:02-05' AS "20:32:00-05";
- 20:32:00-05
--------------
- 20:32:00-05
-(1 row)
-
-SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
- WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
- AND i.f1 BETWEEN '00:00' AND '23:00';
- 102
------------------------------
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:02 1997
- Mon Feb 10 22:32:02 1997
- Mon Feb 10 17:33:01.40 1997
- Mon Feb 10 22:32:01.40 1997
- Mon Feb 10 17:33:01.50 1997
- Mon Feb 10 22:32:01.50 1997
- Mon Feb 10 17:33:01.60 1997
- Mon Feb 10 22:32:01.60 1997
- Thu Jan 02 00:01:00 1997
- Thu Jan 02 05:00:00 1997
- Thu Jan 02 03:05:05 1997
- Thu Jan 02 08:04:05 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Tue Jun 10 17:33:01 1997
- Tue Jun 10 22:32:01 1997
- Wed Mar 15 08:15:01 2000
- Wed Mar 15 13:14:01 2000
- Wed Mar 15 13:15:02 2000
- Wed Mar 15 18:14:02 2000
- Wed Mar 15 12:15:03 2000
- Wed Mar 15 17:14:03 2000
- Wed Mar 15 03:15:04 2000
- Wed Mar 15 08:14:04 2000
- Wed Mar 15 02:15:05 2000
- Wed Mar 15 07:14:05 2000
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:00 1997
- Mon Feb 10 22:32:00 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Tue Jun 10 18:33:01 1997
- Tue Jun 10 23:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Tue Feb 11 17:33:01 1997
- Tue Feb 11 22:32:01 1997
- Wed Feb 12 17:33:01 1997
- Wed Feb 12 22:32:01 1997
- Thu Feb 13 17:33:01 1997
- Thu Feb 13 22:32:01 1997
- Fri Feb 14 17:33:01 1997
- Fri Feb 14 22:32:01 1997
- Sat Feb 15 17:33:01 1997
- Sat Feb 15 22:32:01 1997
- Sun Feb 16 17:33:01 1997
- Sun Feb 16 22:32:01 1997
- Sun Feb 16 17:33:01 1997
- Sun Feb 16 22:32:01 1997
- Wed Feb 28 17:33:01 1996
- Wed Feb 28 22:32:01 1996
- Thu Feb 29 17:33:01 1996
- Thu Feb 29 22:32:01 1996
- Fri Mar 01 17:33:01 1996
- Fri Mar 01 22:32:01 1996
- Mon Dec 30 17:33:01 1996
- Mon Dec 30 22:32:01 1996
- Tue Dec 31 17:33:01 1996
- Tue Dec 31 22:32:01 1996
- Wed Jan 01 17:33:01 1997
- Wed Jan 01 22:32:01 1997
- Fri Feb 28 17:33:01 1997
- Fri Feb 28 22:32:01 1997
- Sat Mar 01 17:33:01 1997
- Sat Mar 01 22:32:01 1997
- Tue Dec 30 17:33:01 1997
- Tue Dec 30 22:32:01 1997
- Wed Dec 31 17:33:01 1997
- Wed Dec 31 22:32:01 1997
- Fri Dec 31 17:33:01 1999
- Fri Dec 31 22:32:01 1999
- Sat Jan 01 17:33:01 2000
- Sat Jan 01 22:32:01 2000
- Sun Dec 31 17:33:01 2000
- Sun Dec 31 22:32:01 2000
-(102 rows)
-
-SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
- WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
- AND i.f1 BETWEEN '00:00' AND '23:00';
- 102
------------------------------
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:02 1997
- Mon Feb 10 12:32:02 1997
- Mon Feb 10 17:31:01.40 1997
- Mon Feb 10 12:32:01.40 1997
- Mon Feb 10 17:31:01.50 1997
- Mon Feb 10 12:32:01.50 1997
- Mon Feb 10 17:31:01.60 1997
- Mon Feb 10 12:32:01.60 1997
- Wed Jan 01 23:59:00 1997
- Wed Jan 01 19:00:00 1997
- Thu Jan 02 03:03:05 1997
- Wed Jan 01 22:04:05 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Tue Jun 10 17:31:01 1997
- Tue Jun 10 12:32:01 1997
- Wed Mar 15 08:13:01 2000
- Wed Mar 15 03:14:01 2000
- Wed Mar 15 13:13:02 2000
- Wed Mar 15 08:14:02 2000
- Wed Mar 15 12:13:03 2000
- Wed Mar 15 07:14:03 2000
- Wed Mar 15 03:13:04 2000
- Tue Mar 14 22:14:04 2000
- Wed Mar 15 02:13:05 2000
- Tue Mar 14 21:14:05 2000
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:00 1997
- Mon Feb 10 12:32:00 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Tue Jun 10 18:31:01 1997
- Tue Jun 10 13:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Tue Feb 11 17:31:01 1997
- Tue Feb 11 12:32:01 1997
- Wed Feb 12 17:31:01 1997
- Wed Feb 12 12:32:01 1997
- Thu Feb 13 17:31:01 1997
- Thu Feb 13 12:32:01 1997
- Fri Feb 14 17:31:01 1997
- Fri Feb 14 12:32:01 1997
- Sat Feb 15 17:31:01 1997
- Sat Feb 15 12:32:01 1997
- Sun Feb 16 17:31:01 1997
- Sun Feb 16 12:32:01 1997
- Sun Feb 16 17:31:01 1997
- Sun Feb 16 12:32:01 1997
- Wed Feb 28 17:31:01 1996
- Wed Feb 28 12:32:01 1996
- Thu Feb 29 17:31:01 1996
- Thu Feb 29 12:32:01 1996
- Fri Mar 01 17:31:01 1996
- Fri Mar 01 12:32:01 1996
- Mon Dec 30 17:31:01 1996
- Mon Dec 30 12:32:01 1996
- Tue Dec 31 17:31:01 1996
- Tue Dec 31 12:32:01 1996
- Wed Jan 01 17:31:01 1997
- Wed Jan 01 12:32:01 1997
- Fri Feb 28 17:31:01 1997
- Fri Feb 28 12:32:01 1997
- Sat Mar 01 17:31:01 1997
- Sat Mar 01 12:32:01 1997
- Tue Dec 30 17:31:01 1997
- Tue Dec 30 12:32:01 1997
- Wed Dec 31 17:31:01 1997
- Wed Dec 31 12:32:01 1997
- Fri Dec 31 17:31:01 1999
- Fri Dec 31 12:32:01 1999
- Sat Jan 01 17:31:01 2000
- Sat Jan 01 12:32:01 2000
- Sun Dec 31 17:31:01 2000
- Sun Dec 31 12:32:01 2000
-(102 rows)
-
-SELECT t.f1 + i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
- 80
--------------
- 00:01:00
- 05:00:00
- 00:00:00
- 00:00:00
- 00:00:00
- 23:59:46
- 02:03:04
- 00:00:00
- 00:00:00
- 12:00:00
- 01:01:00
- 06:00:00
- 01:00:00
- 01:00:00
- 01:00:00
- 00:59:46
- 03:03:04
- 01:00:00
- 01:00:00
- 13:00:00
- 02:04:00
- 07:03:00
- 02:03:00
- 02:03:00
- 02:03:00
- 02:02:46
- 04:06:04
- 02:03:00
- 02:03:00
- 14:03:00
- 12:00:00
- 16:59:00
- 11:59:00
- 11:59:00
- 11:59:00
- 11:58:46
- 14:02:04
- 11:59:00
- 11:59:00
- 23:59:00
- 12:01:00
- 17:00:00
- 12:00:00
- 12:00:00
- 12:00:00
- 11:59:46
- 14:03:04
- 12:00:00
- 12:00:00
- 00:00:00
- 12:02:00
- 17:01:00
- 12:01:00
- 12:01:00
- 12:01:00
- 12:00:46
- 14:04:04
- 12:01:00
- 12:01:00
- 00:01:00
- 00:00:00
- 04:59:00
- 23:59:00
- 23:59:00
- 23:59:00
- 23:58:46
- 02:02:04
- 23:59:00
- 23:59:00
- 11:59:00
- 00:00:59.99
- 04:59:59.99
- 23:59:59.99
- 23:59:59.99
- 23:59:59.99
- 23:59:45.99
- 02:03:03.99
- 23:59:59.99
- 23:59:59.99
- 11:59:59.99
-(80 rows)
-
-SELECT t.f1 - i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
- 80
--------------
- 23:59:00
- 19:00:00
- 00:00:00
- 00:00:00
- 00:00:00
- 00:00:14
- 21:56:56
- 00:00:00
- 00:00:00
- 12:00:00
- 00:59:00
- 20:00:00
- 01:00:00
- 01:00:00
- 01:00:00
- 01:00:14
- 22:56:56
- 01:00:00
- 01:00:00
- 13:00:00
- 02:02:00
- 21:03:00
- 02:03:00
- 02:03:00
- 02:03:00
- 02:03:14
- 23:59:56
- 02:03:00
- 02:03:00
- 14:03:00
- 11:58:00
- 06:59:00
- 11:59:00
- 11:59:00
- 11:59:00
- 11:59:14
- 09:55:56
- 11:59:00
- 11:59:00
- 23:59:00
- 11:59:00
- 07:00:00
- 12:00:00
- 12:00:00
- 12:00:00
- 12:00:14
- 09:56:56
- 12:00:00
- 12:00:00
- 00:00:00
- 12:00:00
- 07:01:00
- 12:01:00
- 12:01:00
- 12:01:00
- 12:01:14
- 09:57:56
- 12:01:00
- 12:01:00
- 00:01:00
- 23:58:00
- 18:59:00
- 23:59:00
- 23:59:00
- 23:59:00
- 23:59:14
- 21:55:56
- 23:59:00
- 23:59:00
- 11:59:00
- 23:58:59.99
- 18:59:59.99
- 23:59:59.99
- 23:59:59.99
- 23:59:59.99
- 00:00:13.99
- 21:56:55.99
- 23:59:59.99
- 23:59:59.99
- 11:59:59.99
-(80 rows)
-
-SELECT t.f1 + i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
- 100
-----------------
- 00:02:00-07
- 05:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:00:46-07
- 02:04:04-07
- 00:01:00-07
- 00:01:00-07
- 12:01:00-07
- 01:01:00-07
- 06:00:00-07
- 01:00:00-07
- 01:00:00-07
- 01:00:00-07
- 00:59:46-07
- 03:03:04-07
- 01:00:00-07
- 01:00:00-07
- 13:00:00-07
- 02:04:00-07
- 07:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:02:46-07
- 04:06:04-07
- 02:03:00-07
- 02:03:00-07
- 14:03:00-07
- 07:08:00-08
- 12:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:06:46-08
- 09:10:04-08
- 07:07:00-08
- 07:07:00-08
- 19:07:00-08
- 08:09:00-04
- 13:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:07:46-04
- 10:11:04-04
- 08:08:00-04
- 08:08:00-04
- 20:08:00-04
- 12:00:00-07
- 16:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:58:46-07
- 14:02:04-07
- 11:59:00-07
- 11:59:00-07
- 23:59:00-07
- 12:01:00-07
- 17:00:00-07
- 12:00:00-07
- 12:00:00-07
- 12:00:00-07
- 11:59:46-07
- 14:03:04-07
- 12:00:00-07
- 12:00:00-07
- 00:00:00-07
- 12:02:00-07
- 17:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:00:46-07
- 14:04:04-07
- 12:01:00-07
- 12:01:00-07
- 00:01:00-07
- 00:00:00-07
- 04:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:58:46-07
- 02:02:04-07
- 23:59:00-07
- 23:59:00-07
- 11:59:00-07
- 00:00:59.99-07
- 04:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 23:59:45.99-07
- 02:03:03.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 11:59:59.99-07
-(100 rows)
-
-SELECT t.f1 - i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
- 100
-----------------
- 00:00:00-07
- 19:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:01:14-07
- 21:57:56-07
- 00:01:00-07
- 00:01:00-07
- 12:01:00-07
- 00:59:00-07
- 20:00:00-07
- 01:00:00-07
- 01:00:00-07
- 01:00:00-07
- 01:00:14-07
- 22:56:56-07
- 01:00:00-07
- 01:00:00-07
- 13:00:00-07
- 02:02:00-07
- 21:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:03:14-07
- 23:59:56-07
- 02:03:00-07
- 02:03:00-07
- 14:03:00-07
- 07:06:00-08
- 02:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:07:14-08
- 05:03:56-08
- 07:07:00-08
- 07:07:00-08
- 19:07:00-08
- 08:07:00-04
- 03:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:08:14-04
- 06:04:56-04
- 08:08:00-04
- 08:08:00-04
- 20:08:00-04
- 11:58:00-07
- 06:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:59:14-07
- 09:55:56-07
- 11:59:00-07
- 11:59:00-07
- 23:59:00-07
- 11:59:00-07
- 07:00:00-07
- 12:00:00-07
- 12:00:00-07
- 12:00:00-07
- 12:00:14-07
- 09:56:56-07
- 12:00:00-07
- 12:00:00-07
- 00:00:00-07
- 12:00:00-07
- 07:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:01:14-07
- 09:57:56-07
- 12:01:00-07
- 12:01:00-07
- 00:01:00-07
- 23:58:00-07
- 18:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:59:14-07
- 21:55:56-07
- 23:59:00-07
- 23:59:00-07
- 11:59:00-07
- 23:58:59.99-07
- 18:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 00:00:13.99-07
- 21:56:55.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 11:59:59.99-07
-(100 rows)
-
--- SQL9x OVERLAPS operator
--- test with time zone
-SELECT (timestamp with time zone '2000-11-27', timestamp with time zone '2000-11-28')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-26', timestamp with time zone '2000-11-27')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', timestamp with time zone '2000-11-28')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', interval '1 day') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp with time zone '2000-11-27', interval '12 hours') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', interval '12 hours') AS "False";
- False
--------
- f
-(1 row)
-
--- test without time zone
-SELECT (timestamp without time zone '2000-11-27', timestamp without time zone '2000-11-28')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-26', timestamp without time zone '2000-11-27')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', timestamp without time zone '2000-11-28')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', interval '1 day') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp without time zone '2000-11-27', interval '12 hours') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', interval '12 hours') AS "False";
- False
--------
- f
-(1 row)
-
--- test time and interval
-SELECT (time '00:00', time '01:00')
- OVERLAPS (time '00:30', time '01:30') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (time '00:00', interval '1 hour')
- OVERLAPS (time '00:30', interval '1 hour') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (time '00:00', interval '1 hour')
- OVERLAPS (time '01:30', interval '1 hour') AS "False";
- False
--------
- f
-(1 row)
-
--- SQL99 seems to want this to be false (and we conform to the spec).
--- istm that this *should* return true, on the theory that time
--- intervals can wrap around the day boundary - thomas 2001-09-25
-SELECT (time '00:00', interval '1 hour')
- OVERLAPS (time '01:30', interval '1 day') AS "False";
- False
--------
- f
-(1 row)
-
-CREATE TABLE TEMP_TIMESTAMP (f1 timestamp with time zone);
--- get some candidate input values
-INSERT INTO TEMP_TIMESTAMP (f1)
- SELECT d1 FROM TIMESTAMP_TBL
- WHERE d1 BETWEEN '13-jun-1957' AND '1-jan-1997'
- OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010';
-SELECT '' AS "16", f1 AS "timestamp"
- FROM TEMP_TIMESTAMP
- ORDER BY "timestamp";
- 16 | timestamp
-----+------------------------------
- | Thu Jan 01 00:00:00 1970 PST
- | Wed Feb 28 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST
- | Fri Dec 31 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST
- | Wed Mar 15 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST
- | Sun Dec 31 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT
-(16 rows)
-
-SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 + t.f1 AS plus
- FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
- ORDER BY plus, "timestamp", "interval";
- 160 | timestamp | interval | plus
------+------------------------------+-------------------------------+------------------------------
- | Thu Jan 01 00:00:00 1970 PST | @ 14 secs ago | Wed Dec 31 23:59:46 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 min | Thu Jan 01 00:01:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 hours | Thu Jan 01 05:00:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 day 2 hours 3 mins 4 secs | Fri Jan 02 02:03:04 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 10 days | Sun Jan 11 00:00:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 3 mons | Wed Apr 01 00:00:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons | Mon Jun 01 00:00:00 1970 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons 12 hours | Mon Jun 01 12:00:00 1970 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 6 years | Thu Jan 01 00:00:00 1976 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 14 secs ago | Wed Feb 28 17:31:47 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 min | Wed Feb 28 17:33:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 5 hours | Wed Feb 28 22:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 14 secs ago | Thu Feb 29 17:31:47 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 min | Thu Feb 29 17:33:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Feb 29 19:35:05 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 5 hours | Thu Feb 29 22:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 14 secs ago | Fri Mar 01 17:31:47 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 min | Fri Mar 01 17:33:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Fri Mar 01 19:35:05 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 5 hours | Fri Mar 01 22:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Sat Mar 02 19:35:05 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 10 days | Sat Mar 09 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 10 days | Sun Mar 10 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 10 days | Mon Mar 11 17:32:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 3 mons | Tue May 28 17:32:01 1996 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 3 mons | Wed May 29 17:32:01 1996 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 3 mons | Sat Jun 01 17:32:01 1996 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons | Sun Jul 28 17:32:01 1996 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons 12 hours | Mon Jul 29 05:32:01 1996 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons | Mon Jul 29 17:32:01 1996 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons 12 hours | Tue Jul 30 05:32:01 1996 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons | Thu Aug 01 17:32:01 1996 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons 12 hours | Fri Aug 02 05:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 14 secs ago | Mon Dec 30 17:31:47 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 min | Mon Dec 30 17:33:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 hours | Mon Dec 30 22:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 14 secs ago | Tue Dec 31 17:31:47 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 min | Tue Dec 31 17:33:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Dec 31 19:35:05 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 5 hours | Tue Dec 31 22:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Wed Jan 01 19:35:05 1997 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 10 days | Thu Jan 09 17:32:01 1997 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 10 days | Fri Jan 10 17:32:01 1997 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 3 mons | Sun Mar 30 17:32:01 1997 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 3 mons | Mon Mar 31 17:32:01 1997 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons | Fri May 30 17:32:01 1997 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons 12 hours | Sat May 31 05:32:01 1997 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons | Sat May 31 17:32:01 1997 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons 12 hours | Sun Jun 01 05:32:01 1997 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 14 secs ago | Fri Dec 31 17:31:47 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 min | Fri Dec 31 17:33:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 hours | Fri Dec 31 22:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 14 secs ago | Sat Jan 01 17:31:47 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 min | Sat Jan 01 17:33:01 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 day 2 hours 3 mins 4 secs | Sat Jan 01 19:35:05 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 5 hours | Sat Jan 01 22:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Sun Jan 02 19:35:05 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 10 days | Mon Jan 10 17:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 10 days | Tue Jan 11 17:32:01 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 14 secs ago | Wed Mar 15 02:13:51 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 min | Wed Mar 15 02:15:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 14 secs ago | Wed Mar 15 03:13:50 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 min | Wed Mar 15 03:15:04 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 5 hours | Wed Mar 15 07:14:05 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 14 secs ago | Wed Mar 15 08:13:47 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 5 hours | Wed Mar 15 08:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 min | Wed Mar 15 08:15:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 14 secs ago | Wed Mar 15 12:13:49 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 min | Wed Mar 15 12:15:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 14 secs ago | Wed Mar 15 13:13:48 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 5 hours | Wed Mar 15 13:14:01 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 min | Wed Mar 15 13:15:02 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 5 hours | Wed Mar 15 17:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 5 hours | Wed Mar 15 18:14:02 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 04:17:09 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 05:17:08 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 10:17:05 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 14:17:07 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 15:17:06 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 10 days | Sat Mar 25 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 10 days | Sat Mar 25 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 10 days | Sat Mar 25 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 10 days | Sat Mar 25 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 10 days | Sat Mar 25 13:14:02 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 3 mons | Fri Mar 31 17:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 3 mons | Sat Apr 01 17:32:01 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons | Wed May 31 17:32:01 2000 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons 12 hours | Thu Jun 01 05:32:01 2000 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons | Thu Jun 01 17:32:01 2000 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons 12 hours | Fri Jun 02 05:32:01 2000 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 3 mons | Thu Jun 15 02:14:05 2000 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 3 mons | Thu Jun 15 03:14:04 2000 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 3 mons | Thu Jun 15 08:14:01 2000 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 3 mons | Thu Jun 15 12:14:03 2000 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 3 mons | Thu Jun 15 13:14:02 2000 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons | Tue Aug 15 02:14:05 2000 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons | Tue Aug 15 03:14:04 2000 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons | Tue Aug 15 08:14:01 2000 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons | Tue Aug 15 12:14:03 2000 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons | Tue Aug 15 13:14:02 2000 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons 12 hours | Tue Aug 15 14:14:05 2000 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons 12 hours | Tue Aug 15 15:14:04 2000 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons 12 hours | Tue Aug 15 20:14:01 2000 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons 12 hours | Wed Aug 16 00:14:03 2000 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons 12 hours | Wed Aug 16 01:14:02 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 14 secs ago | Sun Dec 31 17:31:47 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 min | Sun Dec 31 17:33:01 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 5 hours | Sun Dec 31 22:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 14 secs ago | Mon Jan 01 17:31:47 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 min | Mon Jan 01 17:33:01 2001 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Mon Jan 01 19:35:05 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 5 hours | Mon Jan 01 22:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Jan 02 19:35:05 2001 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 10 days | Wed Jan 10 17:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 10 days | Thu Jan 11 17:32:01 2001 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 3 mons | Sat Mar 31 17:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 3 mons | Sun Apr 01 17:32:01 2001 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons | Thu May 31 17:32:01 2001 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons 12 hours | Fri Jun 01 05:32:01 2001 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons | Fri Jun 01 17:32:01 2001 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons 12 hours | Sat Jun 02 05:32:01 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 14 secs ago | Sat Sep 22 18:19:06 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 min | Sat Sep 22 18:20:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 hours | Sat Sep 22 23:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 day 2 hours 3 mins 4 secs | Sun Sep 23 20:22:24 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 10 days | Tue Oct 02 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 3 mons | Sat Dec 22 18:19:20 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons | Fri Feb 22 18:19:20 2002 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons 12 hours | Sat Feb 23 06:19:20 2002 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 6 years | Thu Feb 28 17:32:01 2002 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 6 years | Thu Feb 28 17:32:01 2002 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 6 years | Fri Mar 01 17:32:01 2002 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 6 years | Mon Dec 30 17:32:01 2002 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 6 years | Tue Dec 31 17:32:01 2002 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 34 years | Thu Jan 01 00:00:00 2004 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 6 years | Sat Dec 31 17:32:01 2005 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 6 years | Sun Jan 01 17:32:01 2006 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 6 years | Wed Mar 15 02:14:05 2006 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 6 years | Wed Mar 15 03:14:04 2006 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 6 years | Wed Mar 15 08:14:01 2006 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 6 years | Wed Mar 15 12:14:03 2006 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 6 years | Wed Mar 15 13:14:02 2006 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 6 years | Sun Dec 31 17:32:01 2006 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 6 years | Mon Jan 01 17:32:01 2007 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 6 years | Sat Sep 22 18:19:20 2007 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 34 years | Thu Feb 28 17:32:01 2030 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 34 years | Thu Feb 28 17:32:01 2030 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 34 years | Fri Mar 01 17:32:01 2030 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 34 years | Mon Dec 30 17:32:01 2030 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 34 years | Tue Dec 31 17:32:01 2030 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 34 years | Sat Dec 31 17:32:01 2033 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 34 years | Sun Jan 01 17:32:01 2034 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 34 years | Wed Mar 15 02:14:05 2034 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 34 years | Wed Mar 15 03:14:04 2034 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 34 years | Wed Mar 15 08:14:01 2034 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 34 years | Wed Mar 15 12:14:03 2034 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 34 years | Wed Mar 15 13:14:02 2034 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 34 years | Sun Dec 31 17:32:01 2034 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 34 years | Mon Jan 01 17:32:01 2035 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 34 years | Sat Sep 22 18:19:20 2035 PDT
-(160 rows)
-
-SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 - t.f1 AS minus
- FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
- WHERE isfinite(d.f1)
- ORDER BY minus, "timestamp", "interval";
- 160 | timestamp | interval | minus
------+------------------------------+-------------------------------+------------------------------
- | Thu Jan 01 00:00:00 1970 PST | @ 34 years | Wed Jan 01 00:00:00 1936 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 34 years | Wed Feb 28 17:32:01 1962 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 34 years | Wed Feb 28 17:32:01 1962 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 34 years | Thu Mar 01 17:32:01 1962 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 34 years | Sun Dec 30 17:32:01 1962 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 34 years | Mon Dec 31 17:32:01 1962 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 6 years | Wed Jan 01 00:00:00 1964 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 34 years | Fri Dec 31 17:32:01 1965 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 34 years | Sat Jan 01 17:32:01 1966 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 34 years | Tue Mar 15 02:14:05 1966 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 34 years | Tue Mar 15 03:14:04 1966 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 34 years | Tue Mar 15 08:14:01 1966 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 34 years | Tue Mar 15 12:14:03 1966 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 34 years | Tue Mar 15 13:14:02 1966 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 34 years | Sat Dec 31 17:32:01 1966 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 34 years | Sun Jan 01 17:32:01 1967 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 34 years | Fri Sep 22 18:19:20 1967 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons 12 hours | Thu Jul 31 12:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons | Fri Aug 01 00:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 3 mons | Wed Oct 01 00:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 10 days | Mon Dec 22 00:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Dec 30 21:56:56 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 hours | Wed Dec 31 19:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 min | Wed Dec 31 23:59:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 14 secs ago | Thu Jan 01 00:00:14 1970 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 6 years | Wed Feb 28 17:32:01 1990 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 6 years | Wed Feb 28 17:32:01 1990 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 6 years | Thu Mar 01 17:32:01 1990 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 6 years | Sun Dec 30 17:32:01 1990 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 6 years | Mon Dec 31 17:32:01 1990 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 6 years | Fri Dec 31 17:32:01 1993 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 6 years | Sat Jan 01 17:32:01 1994 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 6 years | Tue Mar 15 02:14:05 1994 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 6 years | Tue Mar 15 03:14:04 1994 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 6 years | Tue Mar 15 08:14:01 1994 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 6 years | Tue Mar 15 12:14:03 1994 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 6 years | Tue Mar 15 13:14:02 1994 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 6 years | Sat Dec 31 17:32:01 1994 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 6 years | Sun Jan 01 17:32:01 1995 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 6 years | Fri Sep 22 18:19:20 1995 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons 12 hours | Thu Sep 28 05:32:01 1995 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons | Thu Sep 28 17:32:01 1995 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons 12 hours | Fri Sep 29 05:32:01 1995 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons | Fri Sep 29 17:32:01 1995 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons 12 hours | Sun Oct 01 05:32:01 1995 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons | Sun Oct 01 17:32:01 1995 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 3 mons | Tue Nov 28 17:32:01 1995 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 3 mons | Wed Nov 29 17:32:01 1995 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 3 mons | Fri Dec 01 17:32:01 1995 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 10 days | Sun Feb 18 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 10 days | Mon Feb 19 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 10 days | Tue Feb 20 17:32:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Feb 27 15:28:57 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 5 hours | Wed Feb 28 12:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Wed Feb 28 15:28:57 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 min | Wed Feb 28 17:31:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 14 secs ago | Wed Feb 28 17:32:15 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 5 hours | Thu Feb 29 12:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Feb 29 15:28:57 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 min | Thu Feb 29 17:31:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 14 secs ago | Thu Feb 29 17:32:15 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 5 hours | Fri Mar 01 12:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 min | Fri Mar 01 17:31:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 14 secs ago | Fri Mar 01 17:32:15 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons 12 hours | Tue Jul 30 05:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons | Tue Jul 30 17:32:01 1996 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons 12 hours | Wed Jul 31 05:32:01 1996 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons | Wed Jul 31 17:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 3 mons | Mon Sep 30 17:32:01 1996 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 3 mons | Mon Sep 30 17:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 10 days | Fri Dec 20 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 10 days | Sat Dec 21 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Sun Dec 29 15:28:57 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 hours | Mon Dec 30 12:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Mon Dec 30 15:28:57 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 min | Mon Dec 30 17:31:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 14 secs ago | Mon Dec 30 17:32:15 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 5 hours | Tue Dec 31 12:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 min | Tue Dec 31 17:31:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 14 secs ago | Tue Dec 31 17:32:15 1996 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons 12 hours | Sat Jul 31 05:32:01 1999 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons | Sat Jul 31 17:32:01 1999 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons 12 hours | Sun Aug 01 05:32:01 1999 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons | Sun Aug 01 17:32:01 1999 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 3 mons | Thu Sep 30 17:32:01 1999 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 3 mons | Fri Oct 01 17:32:01 1999 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons 12 hours | Thu Oct 14 14:14:05 1999 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons 12 hours | Thu Oct 14 15:14:04 1999 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons 12 hours | Thu Oct 14 20:14:01 1999 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons 12 hours | Fri Oct 15 00:14:03 1999 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons 12 hours | Fri Oct 15 01:14:02 1999 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons | Fri Oct 15 02:14:05 1999 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons | Fri Oct 15 03:14:04 1999 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons | Fri Oct 15 08:14:01 1999 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons | Fri Oct 15 12:14:03 1999 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons | Fri Oct 15 13:14:02 1999 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 3 mons | Wed Dec 15 02:14:05 1999 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 3 mons | Wed Dec 15 03:14:04 1999 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 3 mons | Wed Dec 15 08:14:01 1999 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 3 mons | Wed Dec 15 12:14:03 1999 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 3 mons | Wed Dec 15 13:14:02 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 10 days | Tue Dec 21 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 10 days | Wed Dec 22 17:32:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Dec 30 15:28:57 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 hours | Fri Dec 31 12:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Fri Dec 31 15:28:57 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 min | Fri Dec 31 17:31:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 14 secs ago | Fri Dec 31 17:32:15 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 5 hours | Sat Jan 01 12:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 min | Sat Jan 01 17:31:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 14 secs ago | Sat Jan 01 17:32:15 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 10 days | Sun Mar 05 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 10 days | Sun Mar 05 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 10 days | Sun Mar 05 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 10 days | Sun Mar 05 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 10 days | Sun Mar 05 13:14:02 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 00:11:01 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 01:11:00 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 06:10:57 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 10:10:59 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 11:10:58 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 5 hours | Tue Mar 14 21:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 5 hours | Tue Mar 14 22:14:04 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 min | Wed Mar 15 02:13:05 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 14 secs ago | Wed Mar 15 02:14:19 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 min | Wed Mar 15 03:13:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 5 hours | Wed Mar 15 03:14:01 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 14 secs ago | Wed Mar 15 03:14:18 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 5 hours | Wed Mar 15 07:14:03 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 min | Wed Mar 15 08:13:01 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 5 hours | Wed Mar 15 08:14:02 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 14 secs ago | Wed Mar 15 08:14:15 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 min | Wed Mar 15 12:13:03 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 14 secs ago | Wed Mar 15 12:14:17 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 min | Wed Mar 15 13:13:02 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 14 secs ago | Wed Mar 15 13:14:16 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons 12 hours | Mon Jul 31 05:32:01 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons | Mon Jul 31 17:32:01 2000 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons 12 hours | Tue Aug 01 05:32:01 2000 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons | Tue Aug 01 17:32:01 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 3 mons | Sat Sep 30 17:32:01 2000 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 3 mons | Sun Oct 01 17:32:01 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 10 days | Thu Dec 21 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 10 days | Fri Dec 22 17:32:01 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Sat Dec 30 15:28:57 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 5 hours | Sun Dec 31 12:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 day 2 hours 3 mins 4 secs | Sun Dec 31 15:28:57 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 min | Sun Dec 31 17:31:01 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 14 secs ago | Sun Dec 31 17:32:15 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 5 hours | Mon Jan 01 12:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 min | Mon Jan 01 17:31:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 14 secs ago | Mon Jan 01 17:32:15 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons 12 hours | Sun Apr 22 06:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons | Sun Apr 22 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 3 mons | Fri Jun 22 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 10 days | Wed Sep 12 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 day 2 hours 3 mins 4 secs | Fri Sep 21 16:16:16 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 hours | Sat Sep 22 13:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 min | Sat Sep 22 18:18:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 14 secs ago | Sat Sep 22 18:19:34 2001 PDT
-(160 rows)
-
-SELECT '' AS "16", d.f1 AS "timestamp",
- timestamp with time zone '1980-01-06 00:00 GMT' AS gpstime_zero,
- d.f1 - timestamp with time zone '1980-01-06 00:00 GMT' AS difference
- FROM TEMP_TIMESTAMP d
- ORDER BY difference;
- 16 | timestamp | gpstime_zero | difference
-----+------------------------------+------------------------------+-------------------------------------
- | Thu Jan 01 00:00:00 1970 PST | Sat Jan 05 16:00:00 1980 PST | @ 3656 days 16 hours ago
- | Wed Feb 28 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 5898 days 1 hour 32 mins 1 sec
- | Thu Feb 29 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 5899 days 1 hour 32 mins 1 sec
- | Fri Mar 01 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 5900 days 1 hour 32 mins 1 sec
- | Mon Dec 30 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 6204 days 1 hour 32 mins 1 sec
- | Tue Dec 31 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 6205 days 1 hour 32 mins 1 sec
- | Fri Dec 31 17:32:01 1999 PST | Sat Jan 05 16:00:00 1980 PST | @ 7300 days 1 hour 32 mins 1 sec
- | Sat Jan 01 17:32:01 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7301 days 1 hour 32 mins 1 sec
- | Wed Mar 15 02:14:05 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 10 hours 14 mins 5 secs
- | Wed Mar 15 03:14:04 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 11 hours 14 mins 4 secs
- | Wed Mar 15 08:14:01 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 16 hours 14 mins 1 sec
- | Wed Mar 15 12:14:03 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 20 hours 14 mins 3 secs
- | Wed Mar 15 13:14:02 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 21 hours 14 mins 2 secs
- | Sun Dec 31 17:32:01 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7666 days 1 hour 32 mins 1 sec
- | Mon Jan 01 17:32:01 2001 PST | Sat Jan 05 16:00:00 1980 PST | @ 7667 days 1 hour 32 mins 1 sec
- | Sat Sep 22 18:19:20 2001 PDT | Sat Jan 05 16:00:00 1980 PST | @ 7931 days 1 hour 19 mins 20 secs
-(16 rows)
-
-SELECT '' AS "226", d1.f1 AS timestamp1, d2.f1 AS timestamp2, d1.f1 - d2.f1 AS difference
- FROM TEMP_TIMESTAMP d1, TEMP_TIMESTAMP d2
- ORDER BY timestamp1, timestamp2, difference;
- 226 | timestamp1 | timestamp2 | difference
------+------------------------------+------------------------------+-------------------------------------------
- | Thu Jan 01 00:00:00 1970 PST | Thu Jan 01 00:00:00 1970 PST | @ 0
- | Thu Jan 01 00:00:00 1970 PST | Wed Feb 28 17:32:01 1996 PST | @ 9554 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Thu Feb 29 17:32:01 1996 PST | @ 9555 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Fri Mar 01 17:32:01 1996 PST | @ 9556 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Mon Dec 30 17:32:01 1996 PST | @ 9860 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Tue Dec 31 17:32:01 1996 PST | @ 9861 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Fri Dec 31 17:32:01 1999 PST | @ 10956 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Sat Jan 01 17:32:01 2000 PST | @ 10957 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 02:14:05 2000 PST | @ 11031 days 2 hours 14 mins 5 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 03:14:04 2000 PST | @ 11031 days 3 hours 14 mins 4 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 08:14:01 2000 PST | @ 11031 days 8 hours 14 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 12:14:03 2000 PST | @ 11031 days 12 hours 14 mins 3 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 13:14:02 2000 PST | @ 11031 days 13 hours 14 mins 2 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Sun Dec 31 17:32:01 2000 PST | @ 11322 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Mon Jan 01 17:32:01 2001 PST | @ 11323 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Sat Sep 22 18:19:20 2001 PDT | @ 11587 days 17 hours 19 mins 20 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9554 days 17 hours 32 mins 1 sec
- | Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 0
- | Wed Feb 28 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 1 day ago
- | Wed Feb 28 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 2 days ago
- | Wed Feb 28 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 306 days ago
- | Wed Feb 28 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 307 days ago
- | Wed Feb 28 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1402 days ago
- | Wed Feb 28 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1403 days ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1476 days 8 hours 42 mins 4 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1476 days 9 hours 42 mins 3 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1476 days 14 hours 42 mins ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1476 days 18 hours 42 mins 2 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1476 days 19 hours 42 mins 1 sec ago
- | Wed Feb 28 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1768 days ago
- | Wed Feb 28 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1769 days ago
- | Wed Feb 28 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 2032 days 23 hours 47 mins 19 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9555 days 17 hours 32 mins 1 sec
- | Thu Feb 29 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 1 day
- | Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 0
- | Thu Feb 29 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 1 day ago
- | Thu Feb 29 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 305 days ago
- | Thu Feb 29 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 306 days ago
- | Thu Feb 29 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1401 days ago
- | Thu Feb 29 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1402 days ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1475 days 8 hours 42 mins 4 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1475 days 9 hours 42 mins 3 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1475 days 14 hours 42 mins ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1475 days 18 hours 42 mins 2 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1475 days 19 hours 42 mins 1 sec ago
- | Thu Feb 29 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1767 days ago
- | Thu Feb 29 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1768 days ago
- | Thu Feb 29 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 2031 days 23 hours 47 mins 19 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9556 days 17 hours 32 mins 1 sec
- | Fri Mar 01 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 2 days
- | Fri Mar 01 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 1 day
- | Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 0
- | Fri Mar 01 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 304 days ago
- | Fri Mar 01 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 305 days ago
- | Fri Mar 01 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1400 days ago
- | Fri Mar 01 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1401 days ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1474 days 8 hours 42 mins 4 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1474 days 9 hours 42 mins 3 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1474 days 14 hours 42 mins ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1474 days 18 hours 42 mins 2 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1474 days 19 hours 42 mins 1 sec ago
- | Fri Mar 01 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1766 days ago
- | Fri Mar 01 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1767 days ago
- | Fri Mar 01 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 2030 days 23 hours 47 mins 19 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9860 days 17 hours 32 mins 1 sec
- | Mon Dec 30 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 306 days
- | Mon Dec 30 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 305 days
- | Mon Dec 30 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 304 days
- | Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 0
- | Mon Dec 30 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 1 day ago
- | Mon Dec 30 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1096 days ago
- | Mon Dec 30 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1097 days ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1170 days 8 hours 42 mins 4 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1170 days 9 hours 42 mins 3 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1170 days 14 hours 42 mins ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1170 days 18 hours 42 mins 2 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1170 days 19 hours 42 mins 1 sec ago
- | Mon Dec 30 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1462 days ago
- | Mon Dec 30 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1463 days ago
- | Mon Dec 30 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 1726 days 23 hours 47 mins 19 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9861 days 17 hours 32 mins 1 sec
- | Tue Dec 31 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 307 days
- | Tue Dec 31 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 306 days
- | Tue Dec 31 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 305 days
- | Tue Dec 31 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 1 day
- | Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 0
- | Tue Dec 31 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1095 days ago
- | Tue Dec 31 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1096 days ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1169 days 8 hours 42 mins 4 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1169 days 9 hours 42 mins 3 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1169 days 14 hours 42 mins ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1169 days 18 hours 42 mins 2 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1169 days 19 hours 42 mins 1 sec ago
- | Tue Dec 31 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1461 days ago
- | Tue Dec 31 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1462 days ago
- | Tue Dec 31 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 1725 days 23 hours 47 mins 19 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Thu Jan 01 00:00:00 1970 PST | @ 10956 days 17 hours 32 mins 1 sec
- | Fri Dec 31 17:32:01 1999 PST | Wed Feb 28 17:32:01 1996 PST | @ 1402 days
- | Fri Dec 31 17:32:01 1999 PST | Thu Feb 29 17:32:01 1996 PST | @ 1401 days
- | Fri Dec 31 17:32:01 1999 PST | Fri Mar 01 17:32:01 1996 PST | @ 1400 days
- | Fri Dec 31 17:32:01 1999 PST | Mon Dec 30 17:32:01 1996 PST | @ 1096 days
- | Fri Dec 31 17:32:01 1999 PST | Tue Dec 31 17:32:01 1996 PST | @ 1095 days
- | Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST | @ 0
- | Fri Dec 31 17:32:01 1999 PST | Sat Jan 01 17:32:01 2000 PST | @ 1 day ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 02:14:05 2000 PST | @ 74 days 8 hours 42 mins 4 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 03:14:04 2000 PST | @ 74 days 9 hours 42 mins 3 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 08:14:01 2000 PST | @ 74 days 14 hours 42 mins ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 12:14:03 2000 PST | @ 74 days 18 hours 42 mins 2 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 13:14:02 2000 PST | @ 74 days 19 hours 42 mins 1 sec ago
- | Fri Dec 31 17:32:01 1999 PST | Sun Dec 31 17:32:01 2000 PST | @ 366 days ago
- | Fri Dec 31 17:32:01 1999 PST | Mon Jan 01 17:32:01 2001 PST | @ 367 days ago
- | Fri Dec 31 17:32:01 1999 PST | Sat Sep 22 18:19:20 2001 PDT | @ 630 days 23 hours 47 mins 19 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 10957 days 17 hours 32 mins 1 sec
- | Sat Jan 01 17:32:01 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1403 days
- | Sat Jan 01 17:32:01 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1402 days
- | Sat Jan 01 17:32:01 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1401 days
- | Sat Jan 01 17:32:01 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1097 days
- | Sat Jan 01 17:32:01 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1096 days
- | Sat Jan 01 17:32:01 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 1 day
- | Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 0
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 73 days 8 hours 42 mins 4 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 73 days 9 hours 42 mins 3 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 73 days 14 hours 42 mins ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 73 days 18 hours 42 mins 2 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 73 days 19 hours 42 mins 1 sec ago
- | Sat Jan 01 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 365 days ago
- | Sat Jan 01 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 366 days ago
- | Sat Jan 01 17:32:01 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 629 days 23 hours 47 mins 19 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 2 hours 14 mins 5 secs
- | Wed Mar 15 02:14:05 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 0
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 59 mins 59 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 5 hours 59 mins 56 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 9 hours 59 mins 58 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 10 hours 59 mins 57 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 15 hours 17 mins 56 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 15 hours 17 mins 56 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 15 hours 5 mins 15 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 3 hours 14 mins 4 secs
- | Wed Mar 15 03:14:04 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 59 mins 59 secs
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 0
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 4 hours 59 mins 57 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 8 hours 59 mins 59 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 9 hours 59 mins 58 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 14 hours 17 mins 57 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 14 hours 17 mins 57 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 14 hours 5 mins 16 secs ago
- | Wed Mar 15 08:14:01 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 8 hours 14 mins 1 sec
- | Wed Mar 15 08:14:01 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 5 hours 59 mins 56 secs
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 4 hours 59 mins 57 secs
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 0
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 4 hours 2 secs ago
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 5 hours 1 sec ago
- | Wed Mar 15 08:14:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 9 hours 18 mins ago
- | Wed Mar 15 08:14:01 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 9 hours 18 mins ago
- | Wed Mar 15 08:14:01 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 9 hours 5 mins 19 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 12 hours 14 mins 3 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 9 hours 59 mins 58 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 8 hours 59 mins 59 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 4 hours 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 0
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 59 mins 59 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 5 hours 17 mins 58 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 5 hours 17 mins 58 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 5 hours 5 mins 17 secs ago
- | Wed Mar 15 13:14:02 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 13 hours 14 mins 2 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 10 hours 59 mins 57 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 9 hours 59 mins 58 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 5 hours 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 59 mins 59 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 0
- | Wed Mar 15 13:14:02 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 4 hours 17 mins 59 secs ago
- | Wed Mar 15 13:14:02 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 4 hours 17 mins 59 secs ago
- | Wed Mar 15 13:14:02 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 4 hours 5 mins 18 secs ago
- | Sun Dec 31 17:32:01 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11322 days 17 hours 32 mins 1 sec
- | Sun Dec 31 17:32:01 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1768 days
- | Sun Dec 31 17:32:01 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1767 days
- | Sun Dec 31 17:32:01 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1766 days
- | Sun Dec 31 17:32:01 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1462 days
- | Sun Dec 31 17:32:01 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1461 days
- | Sun Dec 31 17:32:01 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 366 days
- | Sun Dec 31 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 365 days
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 291 days 15 hours 17 mins 56 secs
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 291 days 14 hours 17 mins 57 secs
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 291 days 9 hours 18 mins
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 291 days 5 hours 17 mins 58 secs
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 291 days 4 hours 17 mins 59 secs
- | Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 0
- | Sun Dec 31 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 1 day ago
- | Sun Dec 31 17:32:01 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 264 days 23 hours 47 mins 19 secs ago
- | Mon Jan 01 17:32:01 2001 PST | Thu Jan 01 00:00:00 1970 PST | @ 11323 days 17 hours 32 mins 1 sec
- | Mon Jan 01 17:32:01 2001 PST | Wed Feb 28 17:32:01 1996 PST | @ 1769 days
- | Mon Jan 01 17:32:01 2001 PST | Thu Feb 29 17:32:01 1996 PST | @ 1768 days
- | Mon Jan 01 17:32:01 2001 PST | Fri Mar 01 17:32:01 1996 PST | @ 1767 days
- | Mon Jan 01 17:32:01 2001 PST | Mon Dec 30 17:32:01 1996 PST | @ 1463 days
- | Mon Jan 01 17:32:01 2001 PST | Tue Dec 31 17:32:01 1996 PST | @ 1462 days
- | Mon Jan 01 17:32:01 2001 PST | Fri Dec 31 17:32:01 1999 PST | @ 367 days
- | Mon Jan 01 17:32:01 2001 PST | Sat Jan 01 17:32:01 2000 PST | @ 366 days
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 02:14:05 2000 PST | @ 292 days 15 hours 17 mins 56 secs
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 03:14:04 2000 PST | @ 292 days 14 hours 17 mins 57 secs
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 08:14:01 2000 PST | @ 292 days 9 hours 18 mins
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 12:14:03 2000 PST | @ 292 days 5 hours 17 mins 58 secs
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 13:14:02 2000 PST | @ 292 days 4 hours 17 mins 59 secs
- | Mon Jan 01 17:32:01 2001 PST | Sun Dec 31 17:32:01 2000 PST | @ 1 day
- | Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST | @ 0
- | Mon Jan 01 17:32:01 2001 PST | Sat Sep 22 18:19:20 2001 PDT | @ 263 days 23 hours 47 mins 19 secs ago
- | Sat Sep 22 18:19:20 2001 PDT | Thu Jan 01 00:00:00 1970 PST | @ 11587 days 17 hours 19 mins 20 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Feb 28 17:32:01 1996 PST | @ 2032 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Thu Feb 29 17:32:01 1996 PST | @ 2031 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Fri Mar 01 17:32:01 1996 PST | @ 2030 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Mon Dec 30 17:32:01 1996 PST | @ 1726 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Tue Dec 31 17:32:01 1996 PST | @ 1725 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Fri Dec 31 17:32:01 1999 PST | @ 630 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Sat Jan 01 17:32:01 2000 PST | @ 629 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 02:14:05 2000 PST | @ 556 days 15 hours 5 mins 15 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 03:14:04 2000 PST | @ 556 days 14 hours 5 mins 16 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 08:14:01 2000 PST | @ 556 days 9 hours 5 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 12:14:03 2000 PST | @ 556 days 5 hours 5 mins 17 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 13:14:02 2000 PST | @ 556 days 4 hours 5 mins 18 secs
- | Sat Sep 22 18:19:20 2001 PDT | Sun Dec 31 17:32:01 2000 PST | @ 264 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Mon Jan 01 17:32:01 2001 PST | @ 263 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Sat Sep 22 18:19:20 2001 PDT | @ 0
-(256 rows)
-
---
--- abstime, reltime arithmetic
---
-SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime
- WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1) < abstime 'Jan 14 14:00:00 1971'
- ORDER BY abstime, reltime;
- ten | abstime | reltime
------+------------------------------+---------------
- | Sat May 10 23:59:12 1947 PST | @ 14 secs ago
- | Sat May 10 23:59:12 1947 PST | @ 1 min
- | Sat May 10 23:59:12 1947 PST | @ 5 hours
- | Sat May 10 23:59:12 1947 PST | @ 10 days
- | Sat May 10 23:59:12 1947 PST | @ 3 mons
- | Wed Dec 31 16:00:00 1969 PST | @ 14 secs ago
- | Wed Dec 31 16:00:00 1969 PST | @ 1 min
- | Wed Dec 31 16:00:00 1969 PST | @ 5 hours
- | Wed Dec 31 16:00:00 1969 PST | @ 10 days
- | Wed Dec 31 16:00:00 1969 PST | @ 3 mons
-(10 rows)
-
--- these four queries should return the same answer
--- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and
--- therefore, should not show up in the results.
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years
- < abstime 'Jan 14 14:00:00 1977';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PST
-(3 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years
- < abstime 'Jan 14 14:00:00 1971';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PST
-(3 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years
- < abstime 'Jan 14 14:00:00 1971';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PST
-(3 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years
- < abstime 'Jan 14 14:00:00 1977';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PST
-(3 rows)
-
---
--- Conversions
---
-SELECT '' AS "16", f1 AS "timestamp", date(f1) AS date
- FROM TEMP_TIMESTAMP
- WHERE f1 <> timestamp 'now'
- ORDER BY date, "timestamp";
- 16 | timestamp | date
-----+------------------------------+------------
- | Thu Jan 01 00:00:00 1970 PST | 01-01-1970
- | Wed Feb 28 17:32:01 1996 PST | 02-28-1996
- | Thu Feb 29 17:32:01 1996 PST | 02-29-1996
- | Fri Mar 01 17:32:01 1996 PST | 03-01-1996
- | Mon Dec 30 17:32:01 1996 PST | 12-30-1996
- | Tue Dec 31 17:32:01 1996 PST | 12-31-1996
- | Fri Dec 31 17:32:01 1999 PST | 12-31-1999
- | Sat Jan 01 17:32:01 2000 PST | 01-01-2000
- | Wed Mar 15 02:14:05 2000 PST | 03-15-2000
- | Wed Mar 15 03:14:04 2000 PST | 03-15-2000
- | Wed Mar 15 08:14:01 2000 PST | 03-15-2000
- | Wed Mar 15 12:14:03 2000 PST | 03-15-2000
- | Wed Mar 15 13:14:02 2000 PST | 03-15-2000
- | Sun Dec 31 17:32:01 2000 PST | 12-31-2000
- | Mon Jan 01 17:32:01 2001 PST | 01-01-2001
- | Sat Sep 22 18:19:20 2001 PDT | 09-22-2001
-(16 rows)
-
-SELECT '' AS "16", f1 AS "timestamp", abstime(f1) AS abstime
- FROM TEMP_TIMESTAMP
- ORDER BY abstime;
- 16 | timestamp | abstime
-----+------------------------------+------------------------------
- | Thu Jan 01 00:00:00 1970 PST | Thu Jan 01 00:00:00 1970 PST
- | Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
- | Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 13:14:02 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT | Sat Sep 22 18:19:20 2001 PDT
-(16 rows)
-
-SELECT '' AS four, f1 AS abstime, date(f1) AS date
- FROM ABSTIME_TBL
- WHERE isfinite(f1) AND f1 <> abstime 'now'
- ORDER BY date, abstime;
- four | abstime | date
-------+------------------------------+------------
- | Sat May 10 23:59:12 1947 PST | 05-10-1947
- | Wed Dec 31 16:00:00 1969 PST | 12-31-1969
- | Sun Jan 14 03:14:21 1973 PST | 01-14-1973
- | Mon May 01 00:30:30 1995 PDT | 05-01-1995
-(4 rows)
-
-SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime
- FROM TIMESTAMP_TBL WHERE NOT isfinite(d1);
- two | timestamp | abstime
------+-----------+-----------
- | -infinity | -infinity
- | infinity | infinity
-(2 rows)
-
-SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp"
- FROM ABSTIME_TBL WHERE NOT isfinite(f1);
-ERROR: cannot convert abstime "invalid" to timestamp
-SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime
- FROM INTERVAL_TBL;
- ten | interval | reltime
------+-------------------------------+-------------------------------
- | @ 1 min | @ 1 min
- | @ 5 hours | @ 5 hours
- | @ 10 days | @ 10 days
- | @ 34 years | @ 34 years
- | @ 3 mons | @ 3 mons
- | @ 14 secs ago | @ 14 secs ago
- | @ 1 day 2 hours 3 mins 4 secs | @ 1 day 2 hours 3 mins 4 secs
- | @ 6 years | @ 6 years
- | @ 5 mons | @ 5 mons
- | @ 5 mons 12 hours | @ 5 mons 12 hours
-(10 rows)
-
-SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval
- FROM RELTIME_TBL;
- six | reltime | interval
------+---------------+---------------
- | @ 1 min | @ 1 min
- | @ 5 hours | @ 5 hours
- | @ 10 days | @ 10 days
- | @ 34 years | @ 34 years
- | @ 3 mons | @ 3 mons
- | @ 14 secs ago | @ 14 secs ago
-(6 rows)
-
-DROP TABLE TEMP_TIMESTAMP;
---
--- Formats
---
-SET DateStyle TO 'US,Postgres';
-SHOW DateStyle;
- DateStyle
----------------
- Postgres, MDY
-(1 row)
-
-SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
- 64 | us_postgres
-----+-----------------------------
- | -infinity
- | infinity
- | Thu Jan 01 00:00:00 1970
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:02 1997
- | Mon Feb 10 17:32:01.40 1997
- | Mon Feb 10 17:32:01.50 1997
- | Mon Feb 10 17:32:01.60 1997
- | Thu Jan 02 00:00:00 1997
- | Thu Jan 02 03:04:05 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Tue Jun 10 17:32:01 1997
- | Sat Sep 22 18:19:20 2001
- | Wed Mar 15 08:14:01 2000
- | Wed Mar 15 13:14:02 2000
- | Wed Mar 15 12:14:03 2000
- | Wed Mar 15 03:14:04 2000
- | Wed Mar 15 02:14:05 2000
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:00 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Tue Jun 10 18:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Tue Feb 11 17:32:01 1997
- | Wed Feb 12 17:32:01 1997
- | Thu Feb 13 17:32:01 1997
- | Fri Feb 14 17:32:01 1997
- | Sat Feb 15 17:32:01 1997
- | Sun Feb 16 17:32:01 1997
- | Tue Feb 16 17:32:01 0097 BC
- | Sat Feb 16 17:32:01 0097
- | Thu Feb 16 17:32:01 0597
- | Tue Feb 16 17:32:01 1097
- | Sat Feb 16 17:32:01 1697
- | Thu Feb 16 17:32:01 1797
- | Tue Feb 16 17:32:01 1897
- | Sun Feb 16 17:32:01 1997
- | Sat Feb 16 17:32:01 2097
- | Wed Feb 28 17:32:01 1996
- | Thu Feb 29 17:32:01 1996
- | Fri Mar 01 17:32:01 1996
- | Mon Dec 30 17:32:01 1996
- | Tue Dec 31 17:32:01 1996
- | Wed Jan 01 17:32:01 1997
- | Fri Feb 28 17:32:01 1997
- | Sat Mar 01 17:32:01 1997
- | Tue Dec 30 17:32:01 1997
- | Wed Dec 31 17:32:01 1997
- | Fri Dec 31 17:32:01 1999
- | Sat Jan 01 17:32:01 2000
- | Sun Dec 31 17:32:01 2000
- | Mon Jan 01 17:32:01 2001
-(64 rows)
-
-SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL;
- seven | us_postgres
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
- | infinity
- | -infinity
- | Sat May 10 23:59:12 1947 PST
- | invalid
-(7 rows)
-
-SET DateStyle TO 'US,ISO';
-SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL;
- 64 | us_iso
-----+------------------------
- | -infinity
- | infinity
- | 1970-01-01 00:00:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:02
- | 1997-02-10 17:32:01.40
- | 1997-02-10 17:32:01.50
- | 1997-02-10 17:32:01.60
- | 1997-01-02 00:00:00
- | 1997-01-02 03:04:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 17:32:01
- | 2001-09-22 18:19:20
- | 2000-03-15 08:14:01
- | 2000-03-15 13:14:02
- | 2000-03-15 12:14:03
- | 2000-03-15 03:14:04
- | 2000-03-15 02:14:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 18:32:01
- | 1997-02-10 17:32:01
- | 1997-02-11 17:32:01
- | 1997-02-12 17:32:01
- | 1997-02-13 17:32:01
- | 1997-02-14 17:32:01
- | 1997-02-15 17:32:01
- | 1997-02-16 17:32:01
- | 0097-02-16 17:32:01 BC
- | 0097-02-16 17:32:01
- | 0597-02-16 17:32:01
- | 1097-02-16 17:32:01
- | 1697-02-16 17:32:01
- | 1797-02-16 17:32:01
- | 1897-02-16 17:32:01
- | 1997-02-16 17:32:01
- | 2097-02-16 17:32:01
- | 1996-02-28 17:32:01
- | 1996-02-29 17:32:01
- | 1996-03-01 17:32:01
- | 1996-12-30 17:32:01
- | 1996-12-31 17:32:01
- | 1997-01-01 17:32:01
- | 1997-02-28 17:32:01
- | 1997-03-01 17:32:01
- | 1997-12-30 17:32:01
- | 1997-12-31 17:32:01
- | 1999-12-31 17:32:01
- | 2000-01-01 17:32:01
- | 2000-12-31 17:32:01
- | 2001-01-01 17:32:01
-(64 rows)
-
-SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
- seven | us_iso
--------+------------------------
- | 1973-01-14 03:14:21-08
- | 1995-05-01 00:30:30-07
- | 1969-12-31 16:00:00-08
- | infinity
- | -infinity
- | 1947-05-10 23:59:12-08
- | invalid
-(7 rows)
-
-SET DateStyle TO 'US,SQL';
-SHOW DateStyle;
- DateStyle
------------
- SQL, MDY
-(1 row)
-
-SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
- 64 | us_sql
-----+------------------------
- | -infinity
- | infinity
- | 01/01/1970 00:00:00
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:02
- | 02/10/1997 17:32:01.40
- | 02/10/1997 17:32:01.50
- | 02/10/1997 17:32:01.60
- | 01/02/1997 00:00:00
- | 01/02/1997 03:04:05
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 06/10/1997 17:32:01
- | 09/22/2001 18:19:20
- | 03/15/2000 08:14:01
- | 03/15/2000 13:14:02
- | 03/15/2000 12:14:03
- | 03/15/2000 03:14:04
- | 03/15/2000 02:14:05
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:00
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 06/10/1997 18:32:01
- | 02/10/1997 17:32:01
- | 02/11/1997 17:32:01
- | 02/12/1997 17:32:01
- | 02/13/1997 17:32:01
- | 02/14/1997 17:32:01
- | 02/15/1997 17:32:01
- | 02/16/1997 17:32:01
- | 02/16/0097 17:32:01 BC
- | 02/16/0097 17:32:01
- | 02/16/0597 17:32:01
- | 02/16/1097 17:32:01
- | 02/16/1697 17:32:01
- | 02/16/1797 17:32:01
- | 02/16/1897 17:32:01
- | 02/16/1997 17:32:01
- | 02/16/2097 17:32:01
- | 02/28/1996 17:32:01
- | 02/29/1996 17:32:01
- | 03/01/1996 17:32:01
- | 12/30/1996 17:32:01
- | 12/31/1996 17:32:01
- | 01/01/1997 17:32:01
- | 02/28/1997 17:32:01
- | 03/01/1997 17:32:01
- | 12/30/1997 17:32:01
- | 12/31/1997 17:32:01
- | 12/31/1999 17:32:01
- | 01/01/2000 17:32:01
- | 12/31/2000 17:32:01
- | 01/01/2001 17:32:01
-(64 rows)
-
-SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
- seven | us_sql
--------+-------------------------
- | 01/14/1973 03:14:21 PST
- | 05/01/1995 00:30:30 PDT
- | 12/31/1969 16:00:00 PST
- | infinity
- | -infinity
- | 05/10/1947 23:59:12 PST
- | invalid
-(7 rows)
-
-SET DateStyle TO 'European,Postgres';
-SHOW DateStyle;
- DateStyle
----------------
- Postgres, DMY
-(1 row)
-
-INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
-SELECT count(*) as one FROM TIMESTAMP_TBL WHERE d1 = 'Jun 13 1957';
- one
------
- 1
-(1 row)
-
-SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL;
- 65 | european_postgres
-----+-----------------------------
- | -infinity
- | infinity
- | Thu 01 Jan 00:00:00 1970
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:02 1997
- | Mon 10 Feb 17:32:01.40 1997
- | Mon 10 Feb 17:32:01.50 1997
- | Mon 10 Feb 17:32:01.60 1997
- | Thu 02 Jan 00:00:00 1997
- | Thu 02 Jan 03:04:05 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Tue 10 Jun 17:32:01 1997
- | Sat 22 Sep 18:19:20 2001
- | Wed 15 Mar 08:14:01 2000
- | Wed 15 Mar 13:14:02 2000
- | Wed 15 Mar 12:14:03 2000
- | Wed 15 Mar 03:14:04 2000
- | Wed 15 Mar 02:14:05 2000
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:00 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Tue 10 Jun 18:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Tue 11 Feb 17:32:01 1997
- | Wed 12 Feb 17:32:01 1997
- | Thu 13 Feb 17:32:01 1997
- | Fri 14 Feb 17:32:01 1997
- | Sat 15 Feb 17:32:01 1997
- | Sun 16 Feb 17:32:01 1997
- | Tue 16 Feb 17:32:01 0097 BC
- | Sat 16 Feb 17:32:01 0097
- | Thu 16 Feb 17:32:01 0597
- | Tue 16 Feb 17:32:01 1097
- | Sat 16 Feb 17:32:01 1697
- | Thu 16 Feb 17:32:01 1797
- | Tue 16 Feb 17:32:01 1897
- | Sun 16 Feb 17:32:01 1997
- | Sat 16 Feb 17:32:01 2097
- | Wed 28 Feb 17:32:01 1996
- | Thu 29 Feb 17:32:01 1996
- | Fri 01 Mar 17:32:01 1996
- | Mon 30 Dec 17:32:01 1996
- | Tue 31 Dec 17:32:01 1996
- | Wed 01 Jan 17:32:01 1997
- | Fri 28 Feb 17:32:01 1997
- | Sat 01 Mar 17:32:01 1997
- | Tue 30 Dec 17:32:01 1997
- | Wed 31 Dec 17:32:01 1997
- | Fri 31 Dec 17:32:01 1999
- | Sat 01 Jan 17:32:01 2000
- | Sun 31 Dec 17:32:01 2000
- | Mon 01 Jan 17:32:01 2001
- | Thu 13 Jun 00:00:00 1957
-(65 rows)
-
-SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
- seven | european_postgres
--------+------------------------------
- | Sun 14 Jan 03:14:21 1973 PST
- | Mon 01 May 00:30:30 1995 PDT
- | Wed 31 Dec 16:00:00 1969 PST
- | infinity
- | -infinity
- | Sat 10 May 23:59:12 1947 PST
- | invalid
-(7 rows)
-
-SET DateStyle TO 'European,ISO';
-SHOW DateStyle;
- DateStyle
------------
- ISO, DMY
-(1 row)
-
-SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
- 65 | european_iso
-----+------------------------
- | -infinity
- | infinity
- | 1970-01-01 00:00:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:02
- | 1997-02-10 17:32:01.40
- | 1997-02-10 17:32:01.50
- | 1997-02-10 17:32:01.60
- | 1997-01-02 00:00:00
- | 1997-01-02 03:04:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 17:32:01
- | 2001-09-22 18:19:20
- | 2000-03-15 08:14:01
- | 2000-03-15 13:14:02
- | 2000-03-15 12:14:03
- | 2000-03-15 03:14:04
- | 2000-03-15 02:14:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 18:32:01
- | 1997-02-10 17:32:01
- | 1997-02-11 17:32:01
- | 1997-02-12 17:32:01
- | 1997-02-13 17:32:01
- | 1997-02-14 17:32:01
- | 1997-02-15 17:32:01
- | 1997-02-16 17:32:01
- | 0097-02-16 17:32:01 BC
- | 0097-02-16 17:32:01
- | 0597-02-16 17:32:01
- | 1097-02-16 17:32:01
- | 1697-02-16 17:32:01
- | 1797-02-16 17:32:01
- | 1897-02-16 17:32:01
- | 1997-02-16 17:32:01
- | 2097-02-16 17:32:01
- | 1996-02-28 17:32:01
- | 1996-02-29 17:32:01
- | 1996-03-01 17:32:01
- | 1996-12-30 17:32:01
- | 1996-12-31 17:32:01
- | 1997-01-01 17:32:01
- | 1997-02-28 17:32:01
- | 1997-03-01 17:32:01
- | 1997-12-30 17:32:01
- | 1997-12-31 17:32:01
- | 1999-12-31 17:32:01
- | 2000-01-01 17:32:01
- | 2000-12-31 17:32:01
- | 2001-01-01 17:32:01
- | 1957-06-13 00:00:00
-(65 rows)
-
-SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
- seven | european_iso
--------+------------------------
- | 1973-01-14 03:14:21-08
- | 1995-05-01 00:30:30-07
- | 1969-12-31 16:00:00-08
- | infinity
- | -infinity
- | 1947-05-10 23:59:12-08
- | invalid
-(7 rows)
-
-SET DateStyle TO 'European,SQL';
-SHOW DateStyle;
- DateStyle
------------
- SQL, DMY
-(1 row)
-
-SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
- 65 | european_sql
-----+------------------------
- | -infinity
- | infinity
- | 01/01/1970 00:00:00
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:02
- | 10/02/1997 17:32:01.40
- | 10/02/1997 17:32:01.50
- | 10/02/1997 17:32:01.60
- | 02/01/1997 00:00:00
- | 02/01/1997 03:04:05
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/06/1997 17:32:01
- | 22/09/2001 18:19:20
- | 15/03/2000 08:14:01
- | 15/03/2000 13:14:02
- | 15/03/2000 12:14:03
- | 15/03/2000 03:14:04
- | 15/03/2000 02:14:05
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:00
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/06/1997 18:32:01
- | 10/02/1997 17:32:01
- | 11/02/1997 17:32:01
- | 12/02/1997 17:32:01
- | 13/02/1997 17:32:01
- | 14/02/1997 17:32:01
- | 15/02/1997 17:32:01
- | 16/02/1997 17:32:01
- | 16/02/0097 17:32:01 BC
- | 16/02/0097 17:32:01
- | 16/02/0597 17:32:01
- | 16/02/1097 17:32:01
- | 16/02/1697 17:32:01
- | 16/02/1797 17:32:01
- | 16/02/1897 17:32:01
- | 16/02/1997 17:32:01
- | 16/02/2097 17:32:01
- | 28/02/1996 17:32:01
- | 29/02/1996 17:32:01
- | 01/03/1996 17:32:01
- | 30/12/1996 17:32:01
- | 31/12/1996 17:32:01
- | 01/01/1997 17:32:01
- | 28/02/1997 17:32:01
- | 01/03/1997 17:32:01
- | 30/12/1997 17:32:01
- | 31/12/1997 17:32:01
- | 31/12/1999 17:32:01
- | 01/01/2000 17:32:01
- | 31/12/2000 17:32:01
- | 01/01/2001 17:32:01
- | 13/06/1957 00:00:00
-(65 rows)
-
-SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL;
- seven | european_sql
--------+-------------------------
- | 14/01/1973 03:14:21 PST
- | 01/05/1995 00:30:30 PDT
- | 31/12/1969 16:00:00 PST
- | infinity
- | -infinity
- | 10/05/1947 23:59:12 PST
- | invalid
-(7 rows)
-
-RESET DateStyle;
+++ /dev/null
---
--- HOROLOGY
---
--- needed so tests pass even in Australia
-SET australian_timezones = 'off';
-SET DateStyle = 'Postgres, MDY';
---
--- Test various input formats
---
-SELECT timestamp with time zone '20011227 040506+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227 040506-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227 040506.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227 040506.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '20011227T040506.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '2001-12-27 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '2001.12.27 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '2001/12/27 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '12/27/2001 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
--- should fail in mdy mode:
-SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
-ERROR: date/time field value out of range: "27/12/2001 04:05:06.789-08"
-HINT: Perhaps you need a different "datestyle" setting.
-set datestyle to dmy;
-SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu 27 Dec 04:05:06.789 2001 PST
-(1 row)
-
-reset datestyle;
-SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271+08';
- timestamptz
-------------------------------
- Wed Dec 26 08:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271-08';
- timestamptz
-------------------------------
- Thu Dec 27 00:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271.5+08';
- timestamptz
-------------------------------
- Wed Dec 26 20:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271.5-08';
- timestamptz
-------------------------------
- Thu Dec 27 12:00:00 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271 04:05:06+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271 04:05:06-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506+08';
- timestamptz
-------------------------------
- Wed Dec 26 12:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506-08';
- timestamptz
-------------------------------
- Thu Dec 27 04:05:06 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone 'J2452271T040506.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
--- German/European-style dates with periods as delimiters
-SELECT timestamp with time zone '12.27.2001 04:05:06.789+08';
- timestamptz
-----------------------------------
- Wed Dec 26 12:05:06.789 2001 PST
-(1 row)
-
-SELECT timestamp with time zone '12.27.2001 04:05:06.789-08';
- timestamptz
-----------------------------------
- Thu Dec 27 04:05:06.789 2001 PST
-(1 row)
-
-SET DateStyle = 'German';
-SELECT timestamp with time zone '27.12.2001 04:05:06.789+08';
- timestamptz
------------------------------
- 26.12.2001 12:05:06.789 PST
-(1 row)
-
-SELECT timestamp with time zone '27.12.2001 04:05:06.789-08';
- timestamptz
------------------------------
- 27.12.2001 04:05:06.789 PST
-(1 row)
-
-SET DateStyle = 'ISO';
--- As of 7.4, allow time without time zone having a time zone specified
-SELECT time without time zone '040506.789+08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time without time zone '040506.789-08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time without time zone 'T040506.789+08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time without time zone 'T040506.789-08';
- time
----------------
- 04:05:06.7890
-(1 row)
-
-SELECT time with time zone '040506.789+08';
- timetz
-------------------
- 04:05:06.7890+08
-(1 row)
-
-SELECT time with time zone '040506.789-08';
- timetz
-------------------
- 04:05:06.7890-08
-(1 row)
-
-SELECT time with time zone 'T040506.789+08';
- timetz
-------------------
- 04:05:06.7890+08
-(1 row)
-
-SELECT time with time zone 'T040506.789-08';
- timetz
-------------------
- 04:05:06.7890-08
-(1 row)
-
-SELECT time with time zone 'T040506.789 +08';
- timetz
-------------------
- 04:05:06.7890+08
-(1 row)
-
-SELECT time with time zone 'T040506.789 -08';
- timetz
-------------------
- 04:05:06.7890-08
-(1 row)
-
-SET DateStyle = 'Postgres, MDY';
---
--- date, time arithmetic
---
-SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
- Date + Time
---------------------------
- Tue Feb 03 04:05:06 1981
-(1 row)
-
-SELECT date '1991-02-03' + time with time zone '04:05:06 PST' AS "Date + Time PST";
- Date + Time PST
-------------------------------
- Sun Feb 03 04:05:06 1991 PST
-(1 row)
-
-SELECT date '2001-02-03' + time with time zone '04:05:06 UTC' AS "Date + Time UTC";
- Date + Time UTC
-------------------------------
- Fri Feb 02 20:05:06 2001 PST
-(1 row)
-
-SELECT date '1991-02-03' + interval '2 years' AS "Add Two Years";
- Add Two Years
---------------------------
- Wed Feb 03 00:00:00 1993
-(1 row)
-
-SELECT date '2001-12-13' - interval '2 years' AS "Subtract Two Years";
- Subtract Two Years
---------------------------
- Mon Dec 13 00:00:00 1999
-(1 row)
-
--- subtract time from date should not make sense; use interval instead
-SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
- Subtract Time
---------------------------
- Sat Feb 02 19:54:54 1991
-(1 row)
-
-SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
-ERROR: operator does not exist: date - time with time zone
-HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
---
--- timestamp, interval arithmetic
---
-SELECT timestamp without time zone '1996-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
---------------------------
- Thu Feb 29 23:59:59 1996
-(1 row)
-
-SELECT timestamp without time zone '1999-03-01' - interval '1 second' AS "Feb 28";
- Feb 28
---------------------------
- Sun Feb 28 23:59:59 1999
-(1 row)
-
-SELECT timestamp without time zone '2000-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
---------------------------
- Tue Feb 29 23:59:59 2000
-(1 row)
-
-SELECT timestamp without time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31";
- Dec 31
---------------------------
- Fri Dec 31 23:59:59 1999
-(1 row)
-
-SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' AS "Feb 23, 285506";
- Feb 23, 285506
-----------------------------
- Fri Feb 23 00:00:00 285506
-(1 row)
-
-SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244";
- Jan 20, 288244
-----------------------------
- Sat Jan 20 00:00:00 288244
-(1 row)
-
-SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276";
- Dec 31, 294276
-----------------------------
- Sun Dec 31 00:00:00 294276
-(1 row)
-
-SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
- 106751991 Days
-------------------
- @ 106751991 days
-(1 row)
-
--- Shorthand values
--- Not directly usable for regression testing since these are not constants.
--- So, just try to test parser and hope for the best - thomas 97/04/26
-SELECT (timestamp without time zone 'today' = (timestamp without time zone 'yesterday' + interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone 'today' = (timestamp without time zone 'tomorrow' - interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone 'tomorrow' = (timestamp without time zone 'yesterday' + interval '2 days')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone 'tomorrow' > 'now') as "True";
- True
-------
- t
-(1 row)
-
--- Convert from date and time to timestamp
--- This test used to be timestamp(date,time) but no longer allowed by grammar
--- to enable support for SQL99 timestamp type syntax.
-SELECT date '1994-01-01' + time '11:00' AS "Jan_01_1994_11am";
- Jan_01_1994_11am
---------------------------
- Sat Jan 01 11:00:00 1994
-(1 row)
-
-SELECT date '1994-01-01' + time '10:00' AS "Jan_01_1994_10am";
- Jan_01_1994_10am
---------------------------
- Sat Jan 01 10:00:00 1994
-(1 row)
-
-SELECT date '1994-01-01' + timetz '11:00-5' AS "Jan_01_1994_8am";
- Jan_01_1994_8am
-------------------------------
- Sat Jan 01 08:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am";
- Jan_01_1994_8am
-------------------------------
- Sat Jan 01 08:00:00 1994 PST
-(1 row)
-
-SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL;
- 64 | one_year
-----+-----------------------------
- | -infinity
- | infinity
- | Fri Jan 01 00:00:00 1971
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:02 1998
- | Tue Feb 10 17:32:01.40 1998
- | Tue Feb 10 17:32:01.50 1998
- | Tue Feb 10 17:32:01.60 1998
- | Fri Jan 02 00:00:00 1998
- | Fri Jan 02 03:04:05 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Wed Jun 10 17:32:01 1998
- | Sun Sep 22 18:19:20 2002
- | Thu Mar 15 08:14:01 2001
- | Thu Mar 15 13:14:02 2001
- | Thu Mar 15 12:14:03 2001
- | Thu Mar 15 03:14:04 2001
- | Thu Mar 15 02:14:05 2001
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:00 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Wed Jun 10 18:32:01 1998
- | Tue Feb 10 17:32:01 1998
- | Wed Feb 11 17:32:01 1998
- | Thu Feb 12 17:32:01 1998
- | Fri Feb 13 17:32:01 1998
- | Sat Feb 14 17:32:01 1998
- | Sun Feb 15 17:32:01 1998
- | Mon Feb 16 17:32:01 1998
- | Thu Feb 16 17:32:01 0096 BC
- | Sun Feb 16 17:32:01 0098
- | Fri Feb 16 17:32:01 0598
- | Wed Feb 16 17:32:01 1098
- | Sun Feb 16 17:32:01 1698
- | Fri Feb 16 17:32:01 1798
- | Wed Feb 16 17:32:01 1898
- | Mon Feb 16 17:32:01 1998
- | Sun Feb 16 17:32:01 2098
- | Fri Feb 28 17:32:01 1997
- | Fri Feb 28 17:32:01 1997
- | Sat Mar 01 17:32:01 1997
- | Tue Dec 30 17:32:01 1997
- | Wed Dec 31 17:32:01 1997
- | Thu Jan 01 17:32:01 1998
- | Sat Feb 28 17:32:01 1998
- | Sun Mar 01 17:32:01 1998
- | Wed Dec 30 17:32:01 1998
- | Thu Dec 31 17:32:01 1998
- | Sun Dec 31 17:32:01 2000
- | Mon Jan 01 17:32:01 2001
- | Mon Dec 31 17:32:01 2001
- | Tue Jan 01 17:32:01 2002
-(64 rows)
-
-SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL;
- 64 | one_year
-----+-----------------------------
- | -infinity
- | infinity
- | Wed Jan 01 00:00:00 1969
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:02 1996
- | Sat Feb 10 17:32:01.40 1996
- | Sat Feb 10 17:32:01.50 1996
- | Sat Feb 10 17:32:01.60 1996
- | Tue Jan 02 00:00:00 1996
- | Tue Jan 02 03:04:05 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Mon Jun 10 17:32:01 1996
- | Fri Sep 22 18:19:20 2000
- | Mon Mar 15 08:14:01 1999
- | Mon Mar 15 13:14:02 1999
- | Mon Mar 15 12:14:03 1999
- | Mon Mar 15 03:14:04 1999
- | Mon Mar 15 02:14:05 1999
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:00 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Mon Jun 10 18:32:01 1996
- | Sat Feb 10 17:32:01 1996
- | Sun Feb 11 17:32:01 1996
- | Mon Feb 12 17:32:01 1996
- | Tue Feb 13 17:32:01 1996
- | Wed Feb 14 17:32:01 1996
- | Thu Feb 15 17:32:01 1996
- | Fri Feb 16 17:32:01 1996
- | Mon Feb 16 17:32:01 0098 BC
- | Thu Feb 16 17:32:01 0096
- | Tue Feb 16 17:32:01 0596
- | Sun Feb 16 17:32:01 1096
- | Thu Feb 16 17:32:01 1696
- | Tue Feb 16 17:32:01 1796
- | Sun Feb 16 17:32:01 1896
- | Fri Feb 16 17:32:01 1996
- | Thu Feb 16 17:32:01 2096
- | Tue Feb 28 17:32:01 1995
- | Tue Feb 28 17:32:01 1995
- | Wed Mar 01 17:32:01 1995
- | Sat Dec 30 17:32:01 1995
- | Sun Dec 31 17:32:01 1995
- | Mon Jan 01 17:32:01 1996
- | Wed Feb 28 17:32:01 1996
- | Fri Mar 01 17:32:01 1996
- | Mon Dec 30 17:32:01 1996
- | Tue Dec 31 17:32:01 1996
- | Thu Dec 31 17:32:01 1998
- | Fri Jan 01 17:32:01 1999
- | Fri Dec 31 17:32:01 1999
- | Sat Jan 01 17:32:01 2000
-(64 rows)
-
-SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
-------------------------------
- Thu Feb 29 23:59:59 1996 PST
-(1 row)
-
-SELECT timestamp with time zone '1999-03-01' - interval '1 second' AS "Feb 28";
- Feb 28
-------------------------------
- Sun Feb 28 23:59:59 1999 PST
-(1 row)
-
-SELECT timestamp with time zone '2000-03-01' - interval '1 second' AS "Feb 29";
- Feb 29
-------------------------------
- Tue Feb 29 23:59:59 2000 PST
-(1 row)
-
-SELECT timestamp with time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31";
- Dec 31
-------------------------------
- Fri Dec 31 23:59:59 1999 PST
-(1 row)
-
-SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone 'today' = (timestamp with time zone 'tomorrow' - interval '1 day')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone 'tomorrow' = (timestamp with time zone 'yesterday' + interval '2 days')) as "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone 'tomorrow' > 'now') as "True";
- True
-------
- t
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time '11:00') AS "Jan_01_1994_10am";
- Jan_01_1994_10am
-------------------------------
- Sat Jan 01 11:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time '10:00') AS "Jan_01_1994_9am";
- Jan_01_1994_9am
-------------------------------
- Sat Jan 01 10:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '11:00-8') AS "Jan_01_1994_11am";
- Jan_01_1994_11am
-------------------------------
- Sat Jan 01 11:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '10:00-8') AS "Jan_01_1994_10am";
- Jan_01_1994_10am
-------------------------------
- Sat Jan 01 10:00:00 1994 PST
-(1 row)
-
-SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am";
- Jan_01_1994_8am
-------------------------------
- Sat Jan 01 08:00:00 1994 PST
-(1 row)
-
-SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
- 64 | one_year
-----+---------------------------------
- | -infinity
- | infinity
- | Thu Dec 31 16:00:00 1970 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:02 1998 PST
- | Tue Feb 10 17:32:01.40 1998 PST
- | Tue Feb 10 17:32:01.50 1998 PST
- | Tue Feb 10 17:32:01.60 1998 PST
- | Fri Jan 02 00:00:00 1998 PST
- | Fri Jan 02 03:04:05 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Wed Jun 10 17:32:01 1998 PDT
- | Sun Sep 22 18:19:20 2002 PDT
- | Thu Mar 15 08:14:01 2001 PST
- | Thu Mar 15 04:14:02 2001 PST
- | Thu Mar 15 02:14:03 2001 PST
- | Thu Mar 15 03:14:04 2001 PST
- | Thu Mar 15 01:14:05 2001 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:00 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 17:32:01 1998 PST
- | Tue Feb 10 09:32:01 1998 PST
- | Tue Feb 10 09:32:01 1998 PST
- | Tue Feb 10 09:32:01 1998 PST
- | Wed Jun 10 18:32:01 1998 PDT
- | Tue Feb 10 17:32:01 1998 PST
- | Wed Feb 11 17:32:01 1998 PST
- | Thu Feb 12 17:32:01 1998 PST
- | Fri Feb 13 17:32:01 1998 PST
- | Sat Feb 14 17:32:01 1998 PST
- | Sun Feb 15 17:32:01 1998 PST
- | Mon Feb 16 17:32:01 1998 PST
- | Thu Feb 16 17:32:01 0096 BC
- | Sun Feb 16 17:32:01 0098
- | Fri Feb 16 17:32:01 0598
- | Wed Feb 16 17:32:01 1098
- | Sun Feb 16 17:32:01 1698
- | Fri Feb 16 17:32:01 1798
- | Wed Feb 16 17:32:01 1898
- | Mon Feb 16 17:32:01 1998 PST
- | Sun Feb 16 17:32:01 2098
- | Fri Feb 28 17:32:01 1997 PST
- | Fri Feb 28 17:32:01 1997 PST
- | Sat Mar 01 17:32:01 1997 PST
- | Tue Dec 30 17:32:01 1997 PST
- | Wed Dec 31 17:32:01 1997 PST
- | Thu Jan 01 17:32:01 1998 PST
- | Sat Feb 28 17:32:01 1998 PST
- | Sun Mar 01 17:32:01 1998 PST
- | Wed Dec 30 17:32:01 1998 PST
- | Thu Dec 31 17:32:01 1998 PST
- | Sun Dec 31 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST
- | Mon Dec 31 17:32:01 2001 PST
- | Tue Jan 01 17:32:01 2002 PST
-(64 rows)
-
-SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
- 64 | one_year
-----+---------------------------------
- | -infinity
- | infinity
- | Tue Dec 31 16:00:00 1968 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:02 1996 PST
- | Sat Feb 10 17:32:01.40 1996 PST
- | Sat Feb 10 17:32:01.50 1996 PST
- | Sat Feb 10 17:32:01.60 1996 PST
- | Tue Jan 02 00:00:00 1996 PST
- | Tue Jan 02 03:04:05 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Mon Jun 10 17:32:01 1996 PDT
- | Fri Sep 22 18:19:20 2000 PDT
- | Mon Mar 15 08:14:01 1999 PST
- | Mon Mar 15 04:14:02 1999 PST
- | Mon Mar 15 02:14:03 1999 PST
- | Mon Mar 15 03:14:04 1999 PST
- | Mon Mar 15 01:14:05 1999 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:00 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 17:32:01 1996 PST
- | Sat Feb 10 09:32:01 1996 PST
- | Sat Feb 10 09:32:01 1996 PST
- | Sat Feb 10 09:32:01 1996 PST
- | Mon Jun 10 18:32:01 1996 PDT
- | Sat Feb 10 17:32:01 1996 PST
- | Sun Feb 11 17:32:01 1996 PST
- | Mon Feb 12 17:32:01 1996 PST
- | Tue Feb 13 17:32:01 1996 PST
- | Wed Feb 14 17:32:01 1996 PST
- | Thu Feb 15 17:32:01 1996 PST
- | Fri Feb 16 17:32:01 1996 PST
- | Mon Feb 16 17:32:01 0098 BC
- | Thu Feb 16 17:32:01 0096
- | Tue Feb 16 17:32:01 0596
- | Sun Feb 16 17:32:01 1096
- | Thu Feb 16 17:32:01 1696
- | Tue Feb 16 17:32:01 1796
- | Sun Feb 16 17:32:01 1896
- | Fri Feb 16 17:32:01 1996 PST
- | Thu Feb 16 17:32:01 2096
- | Tue Feb 28 17:32:01 1995 PST
- | Tue Feb 28 17:32:01 1995 PST
- | Wed Mar 01 17:32:01 1995 PST
- | Sat Dec 30 17:32:01 1995 PST
- | Sun Dec 31 17:32:01 1995 PST
- | Mon Jan 01 17:32:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST
- | Thu Dec 31 17:32:01 1998 PST
- | Fri Jan 01 17:32:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST
-(64 rows)
-
---
--- time, interval arithmetic
---
-SELECT CAST(time '01:02' AS interval) AS "+01:02";
- +01:02
------------------
- @ 1 hour 2 mins
-(1 row)
-
-SELECT CAST(interval '02:03' AS time) AS "02:03:00";
- 02:03:00
-----------
- 02:03:00
-(1 row)
-
-SELECT time '01:30' + interval '02:01' AS "03:31:00";
- 03:31:00
-----------
- 03:31:00
-(1 row)
-
-SELECT time '01:30' - interval '02:01' AS "23:29:00";
- 23:29:00
-----------
- 23:29:00
-(1 row)
-
-SELECT time '02:30' + interval '36:01' AS "14:31:00";
- 14:31:00
-----------
- 14:31:00
-(1 row)
-
-SELECT time '03:30' + interval '1 month 04:01' AS "07:31:00";
- 07:31:00
-----------
- 07:31:00
-(1 row)
-
-SELECT interval '04:30' - time '01:02' AS "20:32:00";
- 20:32:00
-----------
- 20:32:00
-(1 row)
-
-SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
-ERROR: cannot cast type time with time zone to interval
-SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
-ERROR: cannot cast type interval to time with time zone
-SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
- 23:29:00-08
--------------
- 23:29:00-08
-(1 row)
-
-SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
- 14:31:00-08
--------------
- 14:31:00-08
-(1 row)
-
--- These two tests cannot be used because they default to current timezone,
--- which may be either -08 or -07 depending on the time of year.
--- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
--- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
--- Try the following two tests instead, as a poor substitute
-SELECT CAST(CAST(date 'today' + time with time zone '01:30'
- + interval '02:01' AS time with time zone) AS time) AS "03:31:00";
- 03:31:00
-----------
- 03:31:00
-(1 row)
-
-SELECT CAST(cast(date 'today' + time with time zone '03:30'
- + interval '1 month 04:01' as timestamp without time zone) AS time) AS "07:31:00";
- 07:31:00
-----------
- 07:31:00
-(1 row)
-
-SELECT interval '04:30' - time with time zone '01:02-05' AS "20:32:00-05";
- 20:32:00-05
--------------
- 20:32:00-05
-(1 row)
-
-SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
- WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
- AND i.f1 BETWEEN '00:00' AND '23:00';
- 102
------------------------------
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:02 1997
- Mon Feb 10 22:32:02 1997
- Mon Feb 10 17:33:01.40 1997
- Mon Feb 10 22:32:01.40 1997
- Mon Feb 10 17:33:01.50 1997
- Mon Feb 10 22:32:01.50 1997
- Mon Feb 10 17:33:01.60 1997
- Mon Feb 10 22:32:01.60 1997
- Thu Jan 02 00:01:00 1997
- Thu Jan 02 05:00:00 1997
- Thu Jan 02 03:05:05 1997
- Thu Jan 02 08:04:05 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Tue Jun 10 17:33:01 1997
- Tue Jun 10 22:32:01 1997
- Wed Mar 15 08:15:01 2000
- Wed Mar 15 13:14:01 2000
- Wed Mar 15 13:15:02 2000
- Wed Mar 15 18:14:02 2000
- Wed Mar 15 12:15:03 2000
- Wed Mar 15 17:14:03 2000
- Wed Mar 15 03:15:04 2000
- Wed Mar 15 08:14:04 2000
- Wed Mar 15 02:15:05 2000
- Wed Mar 15 07:14:05 2000
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:00 1997
- Mon Feb 10 22:32:00 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Tue Jun 10 18:33:01 1997
- Tue Jun 10 23:32:01 1997
- Mon Feb 10 17:33:01 1997
- Mon Feb 10 22:32:01 1997
- Tue Feb 11 17:33:01 1997
- Tue Feb 11 22:32:01 1997
- Wed Feb 12 17:33:01 1997
- Wed Feb 12 22:32:01 1997
- Thu Feb 13 17:33:01 1997
- Thu Feb 13 22:32:01 1997
- Fri Feb 14 17:33:01 1997
- Fri Feb 14 22:32:01 1997
- Sat Feb 15 17:33:01 1997
- Sat Feb 15 22:32:01 1997
- Sun Feb 16 17:33:01 1997
- Sun Feb 16 22:32:01 1997
- Sun Feb 16 17:33:01 1997
- Sun Feb 16 22:32:01 1997
- Wed Feb 28 17:33:01 1996
- Wed Feb 28 22:32:01 1996
- Thu Feb 29 17:33:01 1996
- Thu Feb 29 22:32:01 1996
- Fri Mar 01 17:33:01 1996
- Fri Mar 01 22:32:01 1996
- Mon Dec 30 17:33:01 1996
- Mon Dec 30 22:32:01 1996
- Tue Dec 31 17:33:01 1996
- Tue Dec 31 22:32:01 1996
- Wed Jan 01 17:33:01 1997
- Wed Jan 01 22:32:01 1997
- Fri Feb 28 17:33:01 1997
- Fri Feb 28 22:32:01 1997
- Sat Mar 01 17:33:01 1997
- Sat Mar 01 22:32:01 1997
- Tue Dec 30 17:33:01 1997
- Tue Dec 30 22:32:01 1997
- Wed Dec 31 17:33:01 1997
- Wed Dec 31 22:32:01 1997
- Fri Dec 31 17:33:01 1999
- Fri Dec 31 22:32:01 1999
- Sat Jan 01 17:33:01 2000
- Sat Jan 01 22:32:01 2000
- Sun Dec 31 17:33:01 2000
- Sun Dec 31 22:32:01 2000
-(102 rows)
-
-SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
- WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
- AND i.f1 BETWEEN '00:00' AND '23:00';
- 102
------------------------------
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:02 1997
- Mon Feb 10 12:32:02 1997
- Mon Feb 10 17:31:01.40 1997
- Mon Feb 10 12:32:01.40 1997
- Mon Feb 10 17:31:01.50 1997
- Mon Feb 10 12:32:01.50 1997
- Mon Feb 10 17:31:01.60 1997
- Mon Feb 10 12:32:01.60 1997
- Wed Jan 01 23:59:00 1997
- Wed Jan 01 19:00:00 1997
- Thu Jan 02 03:03:05 1997
- Wed Jan 01 22:04:05 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Tue Jun 10 17:31:01 1997
- Tue Jun 10 12:32:01 1997
- Wed Mar 15 08:13:01 2000
- Wed Mar 15 03:14:01 2000
- Wed Mar 15 13:13:02 2000
- Wed Mar 15 08:14:02 2000
- Wed Mar 15 12:13:03 2000
- Wed Mar 15 07:14:03 2000
- Wed Mar 15 03:13:04 2000
- Tue Mar 14 22:14:04 2000
- Wed Mar 15 02:13:05 2000
- Tue Mar 14 21:14:05 2000
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:00 1997
- Mon Feb 10 12:32:00 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Tue Jun 10 18:31:01 1997
- Tue Jun 10 13:32:01 1997
- Mon Feb 10 17:31:01 1997
- Mon Feb 10 12:32:01 1997
- Tue Feb 11 17:31:01 1997
- Tue Feb 11 12:32:01 1997
- Wed Feb 12 17:31:01 1997
- Wed Feb 12 12:32:01 1997
- Thu Feb 13 17:31:01 1997
- Thu Feb 13 12:32:01 1997
- Fri Feb 14 17:31:01 1997
- Fri Feb 14 12:32:01 1997
- Sat Feb 15 17:31:01 1997
- Sat Feb 15 12:32:01 1997
- Sun Feb 16 17:31:01 1997
- Sun Feb 16 12:32:01 1997
- Sun Feb 16 17:31:01 1997
- Sun Feb 16 12:32:01 1997
- Wed Feb 28 17:31:01 1996
- Wed Feb 28 12:32:01 1996
- Thu Feb 29 17:31:01 1996
- Thu Feb 29 12:32:01 1996
- Fri Mar 01 17:31:01 1996
- Fri Mar 01 12:32:01 1996
- Mon Dec 30 17:31:01 1996
- Mon Dec 30 12:32:01 1996
- Tue Dec 31 17:31:01 1996
- Tue Dec 31 12:32:01 1996
- Wed Jan 01 17:31:01 1997
- Wed Jan 01 12:32:01 1997
- Fri Feb 28 17:31:01 1997
- Fri Feb 28 12:32:01 1997
- Sat Mar 01 17:31:01 1997
- Sat Mar 01 12:32:01 1997
- Tue Dec 30 17:31:01 1997
- Tue Dec 30 12:32:01 1997
- Wed Dec 31 17:31:01 1997
- Wed Dec 31 12:32:01 1997
- Fri Dec 31 17:31:01 1999
- Fri Dec 31 12:32:01 1999
- Sat Jan 01 17:31:01 2000
- Sat Jan 01 12:32:01 2000
- Sun Dec 31 17:31:01 2000
- Sun Dec 31 12:32:01 2000
-(102 rows)
-
-SELECT t.f1 + i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
- 80
--------------
- 00:01:00
- 05:00:00
- 00:00:00
- 00:00:00
- 00:00:00
- 23:59:46
- 02:03:04
- 00:00:00
- 00:00:00
- 12:00:00
- 01:01:00
- 06:00:00
- 01:00:00
- 01:00:00
- 01:00:00
- 00:59:46
- 03:03:04
- 01:00:00
- 01:00:00
- 13:00:00
- 02:04:00
- 07:03:00
- 02:03:00
- 02:03:00
- 02:03:00
- 02:02:46
- 04:06:04
- 02:03:00
- 02:03:00
- 14:03:00
- 12:00:00
- 16:59:00
- 11:59:00
- 11:59:00
- 11:59:00
- 11:58:46
- 14:02:04
- 11:59:00
- 11:59:00
- 23:59:00
- 12:01:00
- 17:00:00
- 12:00:00
- 12:00:00
- 12:00:00
- 11:59:46
- 14:03:04
- 12:00:00
- 12:00:00
- 00:00:00
- 12:02:00
- 17:01:00
- 12:01:00
- 12:01:00
- 12:01:00
- 12:00:46
- 14:04:04
- 12:01:00
- 12:01:00
- 00:01:00
- 00:00:00
- 04:59:00
- 23:59:00
- 23:59:00
- 23:59:00
- 23:58:46
- 02:02:04
- 23:59:00
- 23:59:00
- 11:59:00
- 00:00:59.99
- 04:59:59.99
- 23:59:59.99
- 23:59:59.99
- 23:59:59.99
- 23:59:45.99
- 02:03:03.99
- 23:59:59.99
- 23:59:59.99
- 11:59:59.99
-(80 rows)
-
-SELECT t.f1 - i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
- 80
--------------
- 23:59:00
- 19:00:00
- 00:00:00
- 00:00:00
- 00:00:00
- 00:00:14
- 21:56:56
- 00:00:00
- 00:00:00
- 12:00:00
- 00:59:00
- 20:00:00
- 01:00:00
- 01:00:00
- 01:00:00
- 01:00:14
- 22:56:56
- 01:00:00
- 01:00:00
- 13:00:00
- 02:02:00
- 21:03:00
- 02:03:00
- 02:03:00
- 02:03:00
- 02:03:14
- 23:59:56
- 02:03:00
- 02:03:00
- 14:03:00
- 11:58:00
- 06:59:00
- 11:59:00
- 11:59:00
- 11:59:00
- 11:59:14
- 09:55:56
- 11:59:00
- 11:59:00
- 23:59:00
- 11:59:00
- 07:00:00
- 12:00:00
- 12:00:00
- 12:00:00
- 12:00:14
- 09:56:56
- 12:00:00
- 12:00:00
- 00:00:00
- 12:00:00
- 07:01:00
- 12:01:00
- 12:01:00
- 12:01:00
- 12:01:14
- 09:57:56
- 12:01:00
- 12:01:00
- 00:01:00
- 23:58:00
- 18:59:00
- 23:59:00
- 23:59:00
- 23:59:00
- 23:59:14
- 21:55:56
- 23:59:00
- 23:59:00
- 11:59:00
- 23:58:59.99
- 18:59:59.99
- 23:59:59.99
- 23:59:59.99
- 23:59:59.99
- 00:00:13.99
- 21:56:55.99
- 23:59:59.99
- 23:59:59.99
- 11:59:59.99
-(80 rows)
-
-SELECT t.f1 + i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
- 100
-----------------
- 00:02:00-07
- 05:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:00:46-07
- 02:04:04-07
- 00:01:00-07
- 00:01:00-07
- 12:01:00-07
- 01:01:00-07
- 06:00:00-07
- 01:00:00-07
- 01:00:00-07
- 01:00:00-07
- 00:59:46-07
- 03:03:04-07
- 01:00:00-07
- 01:00:00-07
- 13:00:00-07
- 02:04:00-07
- 07:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:02:46-07
- 04:06:04-07
- 02:03:00-07
- 02:03:00-07
- 14:03:00-07
- 07:08:00-08
- 12:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:06:46-08
- 09:10:04-08
- 07:07:00-08
- 07:07:00-08
- 19:07:00-08
- 08:09:00-04
- 13:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:07:46-04
- 10:11:04-04
- 08:08:00-04
- 08:08:00-04
- 20:08:00-04
- 12:00:00-07
- 16:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:58:46-07
- 14:02:04-07
- 11:59:00-07
- 11:59:00-07
- 23:59:00-07
- 12:01:00-07
- 17:00:00-07
- 12:00:00-07
- 12:00:00-07
- 12:00:00-07
- 11:59:46-07
- 14:03:04-07
- 12:00:00-07
- 12:00:00-07
- 00:00:00-07
- 12:02:00-07
- 17:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:00:46-07
- 14:04:04-07
- 12:01:00-07
- 12:01:00-07
- 00:01:00-07
- 00:00:00-07
- 04:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:58:46-07
- 02:02:04-07
- 23:59:00-07
- 23:59:00-07
- 11:59:00-07
- 00:00:59.99-07
- 04:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 23:59:45.99-07
- 02:03:03.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 11:59:59.99-07
-(100 rows)
-
-SELECT t.f1 - i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
- 100
-----------------
- 00:00:00-07
- 19:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:01:00-07
- 00:01:14-07
- 21:57:56-07
- 00:01:00-07
- 00:01:00-07
- 12:01:00-07
- 00:59:00-07
- 20:00:00-07
- 01:00:00-07
- 01:00:00-07
- 01:00:00-07
- 01:00:14-07
- 22:56:56-07
- 01:00:00-07
- 01:00:00-07
- 13:00:00-07
- 02:02:00-07
- 21:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:03:00-07
- 02:03:14-07
- 23:59:56-07
- 02:03:00-07
- 02:03:00-07
- 14:03:00-07
- 07:06:00-08
- 02:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:07:00-08
- 07:07:14-08
- 05:03:56-08
- 07:07:00-08
- 07:07:00-08
- 19:07:00-08
- 08:07:00-04
- 03:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:08:00-04
- 08:08:14-04
- 06:04:56-04
- 08:08:00-04
- 08:08:00-04
- 20:08:00-04
- 11:58:00-07
- 06:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:59:00-07
- 11:59:14-07
- 09:55:56-07
- 11:59:00-07
- 11:59:00-07
- 23:59:00-07
- 11:59:00-07
- 07:00:00-07
- 12:00:00-07
- 12:00:00-07
- 12:00:00-07
- 12:00:14-07
- 09:56:56-07
- 12:00:00-07
- 12:00:00-07
- 00:00:00-07
- 12:00:00-07
- 07:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:01:00-07
- 12:01:14-07
- 09:57:56-07
- 12:01:00-07
- 12:01:00-07
- 00:01:00-07
- 23:58:00-07
- 18:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:59:00-07
- 23:59:14-07
- 21:55:56-07
- 23:59:00-07
- 23:59:00-07
- 11:59:00-07
- 23:58:59.99-07
- 18:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 00:00:13.99-07
- 21:56:55.99-07
- 23:59:59.99-07
- 23:59:59.99-07
- 11:59:59.99-07
-(100 rows)
-
--- SQL9x OVERLAPS operator
--- test with time zone
-SELECT (timestamp with time zone '2000-11-27', timestamp with time zone '2000-11-28')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-26', timestamp with time zone '2000-11-27')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', timestamp with time zone '2000-11-28')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', interval '1 day') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp with time zone '2000-11-27', interval '12 hours') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp with time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp with time zone '2000-11-27 12:00', interval '12 hours') AS "False";
- False
--------
- f
-(1 row)
-
--- test without time zone
-SELECT (timestamp without time zone '2000-11-27', timestamp without time zone '2000-11-28')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-26', timestamp without time zone '2000-11-27')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', timestamp without time zone '2000-11-28')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', interval '1 day') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "False";
- False
--------
- f
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp without time zone '2000-11-27', interval '12 hours') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (timestamp without time zone '2000-11-27', interval '12 hours')
- OVERLAPS (timestamp without time zone '2000-11-27 12:00', interval '12 hours') AS "False";
- False
--------
- f
-(1 row)
-
--- test time and interval
-SELECT (time '00:00', time '01:00')
- OVERLAPS (time '00:30', time '01:30') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (time '00:00', interval '1 hour')
- OVERLAPS (time '00:30', interval '1 hour') AS "True";
- True
-------
- t
-(1 row)
-
-SELECT (time '00:00', interval '1 hour')
- OVERLAPS (time '01:30', interval '1 hour') AS "False";
- False
--------
- f
-(1 row)
-
--- SQL99 seems to want this to be false (and we conform to the spec).
--- istm that this *should* return true, on the theory that time
--- intervals can wrap around the day boundary - thomas 2001-09-25
-SELECT (time '00:00', interval '1 hour')
- OVERLAPS (time '01:30', interval '1 day') AS "False";
- False
--------
- f
-(1 row)
-
-CREATE TABLE TEMP_TIMESTAMP (f1 timestamp with time zone);
--- get some candidate input values
-INSERT INTO TEMP_TIMESTAMP (f1)
- SELECT d1 FROM TIMESTAMP_TBL
- WHERE d1 BETWEEN '13-jun-1957' AND '1-jan-1997'
- OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010';
-SELECT '' AS "16", f1 AS "timestamp"
- FROM TEMP_TIMESTAMP
- ORDER BY "timestamp";
- 16 | timestamp
-----+------------------------------
- | Thu Jan 01 00:00:00 1970 PST
- | Wed Feb 28 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST
- | Fri Dec 31 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST
- | Wed Mar 15 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST
- | Sun Dec 31 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT
-(16 rows)
-
-SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 + t.f1 AS plus
- FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
- ORDER BY plus, "timestamp", "interval";
- 160 | timestamp | interval | plus
------+------------------------------+-------------------------------+------------------------------
- | Thu Jan 01 00:00:00 1970 PST | @ 14 secs ago | Wed Dec 31 23:59:46 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 min | Thu Jan 01 00:01:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 hours | Thu Jan 01 05:00:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 day 2 hours 3 mins 4 secs | Fri Jan 02 02:03:04 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 10 days | Sun Jan 11 00:00:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 3 mons | Wed Apr 01 00:00:00 1970 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons | Mon Jun 01 00:00:00 1970 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons 12 hours | Mon Jun 01 12:00:00 1970 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 6 years | Thu Jan 01 00:00:00 1976 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 14 secs ago | Wed Feb 28 17:31:47 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 min | Wed Feb 28 17:33:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 5 hours | Wed Feb 28 22:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 14 secs ago | Thu Feb 29 17:31:47 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 min | Thu Feb 29 17:33:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Feb 29 19:35:05 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 5 hours | Thu Feb 29 22:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 14 secs ago | Fri Mar 01 17:31:47 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 min | Fri Mar 01 17:33:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Fri Mar 01 19:35:05 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 5 hours | Fri Mar 01 22:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Sat Mar 02 19:35:05 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 10 days | Sat Mar 09 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 10 days | Sun Mar 10 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 10 days | Mon Mar 11 17:32:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 3 mons | Tue May 28 17:32:01 1996 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 3 mons | Wed May 29 17:32:01 1996 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 3 mons | Sat Jun 01 17:32:01 1996 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons | Sun Jul 28 17:32:01 1996 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons 12 hours | Mon Jul 29 05:32:01 1996 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons | Mon Jul 29 17:32:01 1996 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons 12 hours | Tue Jul 30 05:32:01 1996 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons | Thu Aug 01 17:32:01 1996 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons 12 hours | Fri Aug 02 05:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 14 secs ago | Mon Dec 30 17:31:47 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 min | Mon Dec 30 17:33:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 hours | Mon Dec 30 22:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 14 secs ago | Tue Dec 31 17:31:47 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 min | Tue Dec 31 17:33:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Dec 31 19:35:05 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 5 hours | Tue Dec 31 22:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Wed Jan 01 19:35:05 1997 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 10 days | Thu Jan 09 17:32:01 1997 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 10 days | Fri Jan 10 17:32:01 1997 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 3 mons | Sun Mar 30 17:32:01 1997 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 3 mons | Mon Mar 31 17:32:01 1997 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons | Fri May 30 17:32:01 1997 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons 12 hours | Sat May 31 05:32:01 1997 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons | Sat May 31 17:32:01 1997 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons 12 hours | Sun Jun 01 05:32:01 1997 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 14 secs ago | Fri Dec 31 17:31:47 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 min | Fri Dec 31 17:33:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 hours | Fri Dec 31 22:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 14 secs ago | Sat Jan 01 17:31:47 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 min | Sat Jan 01 17:33:01 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 day 2 hours 3 mins 4 secs | Sat Jan 01 19:35:05 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 5 hours | Sat Jan 01 22:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Sun Jan 02 19:35:05 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 10 days | Mon Jan 10 17:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 10 days | Tue Jan 11 17:32:01 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 14 secs ago | Wed Mar 15 02:13:51 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 min | Wed Mar 15 02:15:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 14 secs ago | Wed Mar 15 03:13:50 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 min | Wed Mar 15 03:15:04 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 5 hours | Wed Mar 15 07:14:05 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 14 secs ago | Wed Mar 15 08:13:47 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 5 hours | Wed Mar 15 08:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 min | Wed Mar 15 08:15:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 14 secs ago | Wed Mar 15 12:13:49 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 min | Wed Mar 15 12:15:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 14 secs ago | Wed Mar 15 13:13:48 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 5 hours | Wed Mar 15 13:14:01 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 min | Wed Mar 15 13:15:02 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 5 hours | Wed Mar 15 17:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 5 hours | Wed Mar 15 18:14:02 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 04:17:09 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 05:17:08 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 10:17:05 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 14:17:07 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Mar 16 15:17:06 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 10 days | Sat Mar 25 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 10 days | Sat Mar 25 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 10 days | Sat Mar 25 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 10 days | Sat Mar 25 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 10 days | Sat Mar 25 13:14:02 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 3 mons | Fri Mar 31 17:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 3 mons | Sat Apr 01 17:32:01 2000 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons | Wed May 31 17:32:01 2000 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons 12 hours | Thu Jun 01 05:32:01 2000 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons | Thu Jun 01 17:32:01 2000 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons 12 hours | Fri Jun 02 05:32:01 2000 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 3 mons | Thu Jun 15 02:14:05 2000 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 3 mons | Thu Jun 15 03:14:04 2000 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 3 mons | Thu Jun 15 08:14:01 2000 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 3 mons | Thu Jun 15 12:14:03 2000 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 3 mons | Thu Jun 15 13:14:02 2000 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons | Tue Aug 15 02:14:05 2000 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons | Tue Aug 15 03:14:04 2000 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons | Tue Aug 15 08:14:01 2000 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons | Tue Aug 15 12:14:03 2000 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons | Tue Aug 15 13:14:02 2000 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons 12 hours | Tue Aug 15 14:14:05 2000 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons 12 hours | Tue Aug 15 15:14:04 2000 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons 12 hours | Tue Aug 15 20:14:01 2000 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons 12 hours | Wed Aug 16 00:14:03 2000 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons 12 hours | Wed Aug 16 01:14:02 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 14 secs ago | Sun Dec 31 17:31:47 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 min | Sun Dec 31 17:33:01 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 5 hours | Sun Dec 31 22:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 14 secs ago | Mon Jan 01 17:31:47 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 min | Mon Jan 01 17:33:01 2001 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Mon Jan 01 19:35:05 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 5 hours | Mon Jan 01 22:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Jan 02 19:35:05 2001 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 10 days | Wed Jan 10 17:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 10 days | Thu Jan 11 17:32:01 2001 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 3 mons | Sat Mar 31 17:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 3 mons | Sun Apr 01 17:32:01 2001 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons | Thu May 31 17:32:01 2001 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons 12 hours | Fri Jun 01 05:32:01 2001 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons | Fri Jun 01 17:32:01 2001 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons 12 hours | Sat Jun 02 05:32:01 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 14 secs ago | Sat Sep 22 18:19:06 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 min | Sat Sep 22 18:20:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 hours | Sat Sep 22 23:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 day 2 hours 3 mins 4 secs | Sun Sep 23 20:22:24 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 10 days | Tue Oct 02 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 3 mons | Sat Dec 22 18:19:20 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons | Fri Feb 22 18:19:20 2002 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons 12 hours | Sat Feb 23 06:19:20 2002 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 6 years | Thu Feb 28 17:32:01 2002 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 6 years | Thu Feb 28 17:32:01 2002 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 6 years | Fri Mar 01 17:32:01 2002 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 6 years | Mon Dec 30 17:32:01 2002 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 6 years | Tue Dec 31 17:32:01 2002 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 34 years | Thu Jan 01 00:00:00 2004 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 6 years | Sat Dec 31 17:32:01 2005 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 6 years | Sun Jan 01 17:32:01 2006 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 6 years | Wed Mar 15 02:14:05 2006 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 6 years | Wed Mar 15 03:14:04 2006 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 6 years | Wed Mar 15 08:14:01 2006 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 6 years | Wed Mar 15 12:14:03 2006 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 6 years | Wed Mar 15 13:14:02 2006 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 6 years | Sun Dec 31 17:32:01 2006 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 6 years | Mon Jan 01 17:32:01 2007 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 6 years | Sat Sep 22 18:19:20 2007 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 34 years | Thu Feb 28 17:32:01 2030 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 34 years | Thu Feb 28 17:32:01 2030 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 34 years | Fri Mar 01 17:32:01 2030 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 34 years | Mon Dec 30 17:32:01 2030 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 34 years | Tue Dec 31 17:32:01 2030 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 34 years | Sat Dec 31 17:32:01 2033 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 34 years | Sun Jan 01 17:32:01 2034 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 34 years | Wed Mar 15 02:14:05 2034 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 34 years | Wed Mar 15 03:14:04 2034 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 34 years | Wed Mar 15 08:14:01 2034 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 34 years | Wed Mar 15 12:14:03 2034 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 34 years | Wed Mar 15 13:14:02 2034 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 34 years | Sun Dec 31 17:32:01 2034 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 34 years | Mon Jan 01 17:32:01 2035 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 34 years | Sat Sep 22 18:19:20 2035 PDT
-(160 rows)
-
-SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 - t.f1 AS minus
- FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
- WHERE isfinite(d.f1)
- ORDER BY minus, "timestamp", "interval";
- 160 | timestamp | interval | minus
------+------------------------------+-------------------------------+------------------------------
- | Thu Jan 01 00:00:00 1970 PST | @ 34 years | Wed Jan 01 00:00:00 1936 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 34 years | Wed Feb 28 17:32:01 1962 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 34 years | Wed Feb 28 17:32:01 1962 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 34 years | Thu Mar 01 17:32:01 1962 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 34 years | Sun Dec 30 17:32:01 1962 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 34 years | Mon Dec 31 17:32:01 1962 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 6 years | Wed Jan 01 00:00:00 1964 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 34 years | Fri Dec 31 17:32:01 1965 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 34 years | Sat Jan 01 17:32:01 1966 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 34 years | Tue Mar 15 02:14:05 1966 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 34 years | Tue Mar 15 03:14:04 1966 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 34 years | Tue Mar 15 08:14:01 1966 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 34 years | Tue Mar 15 12:14:03 1966 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 34 years | Tue Mar 15 13:14:02 1966 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 34 years | Sat Dec 31 17:32:01 1966 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 34 years | Sun Jan 01 17:32:01 1967 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 34 years | Fri Sep 22 18:19:20 1967 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons 12 hours | Thu Jul 31 12:00:00 1969 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 5 mons | Fri Aug 01 00:00:00 1969 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 3 mons | Wed Oct 01 00:00:00 1969 PDT
- | Thu Jan 01 00:00:00 1970 PST | @ 10 days | Mon Dec 22 00:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Dec 30 21:56:56 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 5 hours | Wed Dec 31 19:00:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 1 min | Wed Dec 31 23:59:00 1969 PST
- | Thu Jan 01 00:00:00 1970 PST | @ 14 secs ago | Thu Jan 01 00:00:14 1970 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 6 years | Wed Feb 28 17:32:01 1990 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 6 years | Wed Feb 28 17:32:01 1990 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 6 years | Thu Mar 01 17:32:01 1990 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 6 years | Sun Dec 30 17:32:01 1990 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 6 years | Mon Dec 31 17:32:01 1990 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 6 years | Fri Dec 31 17:32:01 1993 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 6 years | Sat Jan 01 17:32:01 1994 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 6 years | Tue Mar 15 02:14:05 1994 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 6 years | Tue Mar 15 03:14:04 1994 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 6 years | Tue Mar 15 08:14:01 1994 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 6 years | Tue Mar 15 12:14:03 1994 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 6 years | Tue Mar 15 13:14:02 1994 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 6 years | Sat Dec 31 17:32:01 1994 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 6 years | Sun Jan 01 17:32:01 1995 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 6 years | Fri Sep 22 18:19:20 1995 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons 12 hours | Thu Sep 28 05:32:01 1995 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 5 mons | Thu Sep 28 17:32:01 1995 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons 12 hours | Fri Sep 29 05:32:01 1995 PDT
- | Thu Feb 29 17:32:01 1996 PST | @ 5 mons | Fri Sep 29 17:32:01 1995 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons 12 hours | Sun Oct 01 05:32:01 1995 PDT
- | Fri Mar 01 17:32:01 1996 PST | @ 5 mons | Sun Oct 01 17:32:01 1995 PDT
- | Wed Feb 28 17:32:01 1996 PST | @ 3 mons | Tue Nov 28 17:32:01 1995 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 3 mons | Wed Nov 29 17:32:01 1995 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 3 mons | Fri Dec 01 17:32:01 1995 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 10 days | Sun Feb 18 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 10 days | Mon Feb 19 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 10 days | Tue Feb 20 17:32:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Feb 27 15:28:57 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 5 hours | Wed Feb 28 12:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Wed Feb 28 15:28:57 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 1 min | Wed Feb 28 17:31:01 1996 PST
- | Wed Feb 28 17:32:01 1996 PST | @ 14 secs ago | Wed Feb 28 17:32:15 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 5 hours | Thu Feb 29 12:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Feb 29 15:28:57 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 1 min | Thu Feb 29 17:31:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | @ 14 secs ago | Thu Feb 29 17:32:15 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 5 hours | Fri Mar 01 12:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 1 min | Fri Mar 01 17:31:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | @ 14 secs ago | Fri Mar 01 17:32:15 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons 12 hours | Tue Jul 30 05:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 5 mons | Tue Jul 30 17:32:01 1996 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons 12 hours | Wed Jul 31 05:32:01 1996 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 5 mons | Wed Jul 31 17:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 3 mons | Mon Sep 30 17:32:01 1996 PDT
- | Tue Dec 31 17:32:01 1996 PST | @ 3 mons | Mon Sep 30 17:32:01 1996 PDT
- | Mon Dec 30 17:32:01 1996 PST | @ 10 days | Fri Dec 20 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 10 days | Sat Dec 21 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Sun Dec 29 15:28:57 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 5 hours | Mon Dec 30 12:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 day 2 hours 3 mins 4 secs | Mon Dec 30 15:28:57 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 1 min | Mon Dec 30 17:31:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | @ 14 secs ago | Mon Dec 30 17:32:15 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 5 hours | Tue Dec 31 12:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 1 min | Tue Dec 31 17:31:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | @ 14 secs ago | Tue Dec 31 17:32:15 1996 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons 12 hours | Sat Jul 31 05:32:01 1999 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 5 mons | Sat Jul 31 17:32:01 1999 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons 12 hours | Sun Aug 01 05:32:01 1999 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 5 mons | Sun Aug 01 17:32:01 1999 PDT
- | Fri Dec 31 17:32:01 1999 PST | @ 3 mons | Thu Sep 30 17:32:01 1999 PDT
- | Sat Jan 01 17:32:01 2000 PST | @ 3 mons | Fri Oct 01 17:32:01 1999 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons 12 hours | Thu Oct 14 14:14:05 1999 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons 12 hours | Thu Oct 14 15:14:04 1999 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons 12 hours | Thu Oct 14 20:14:01 1999 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons 12 hours | Fri Oct 15 00:14:03 1999 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons 12 hours | Fri Oct 15 01:14:02 1999 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 5 mons | Fri Oct 15 02:14:05 1999 PDT
- | Wed Mar 15 03:14:04 2000 PST | @ 5 mons | Fri Oct 15 03:14:04 1999 PDT
- | Wed Mar 15 08:14:01 2000 PST | @ 5 mons | Fri Oct 15 08:14:01 1999 PDT
- | Wed Mar 15 12:14:03 2000 PST | @ 5 mons | Fri Oct 15 12:14:03 1999 PDT
- | Wed Mar 15 13:14:02 2000 PST | @ 5 mons | Fri Oct 15 13:14:02 1999 PDT
- | Wed Mar 15 02:14:05 2000 PST | @ 3 mons | Wed Dec 15 02:14:05 1999 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 3 mons | Wed Dec 15 03:14:04 1999 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 3 mons | Wed Dec 15 08:14:01 1999 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 3 mons | Wed Dec 15 12:14:03 1999 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 3 mons | Wed Dec 15 13:14:02 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 10 days | Tue Dec 21 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 10 days | Wed Dec 22 17:32:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 day 2 hours 3 mins 4 secs | Thu Dec 30 15:28:57 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 5 hours | Fri Dec 31 12:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Fri Dec 31 15:28:57 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 1 min | Fri Dec 31 17:31:01 1999 PST
- | Fri Dec 31 17:32:01 1999 PST | @ 14 secs ago | Fri Dec 31 17:32:15 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 5 hours | Sat Jan 01 12:32:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 1 min | Sat Jan 01 17:31:01 2000 PST
- | Sat Jan 01 17:32:01 2000 PST | @ 14 secs ago | Sat Jan 01 17:32:15 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 10 days | Sun Mar 05 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 10 days | Sun Mar 05 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 10 days | Sun Mar 05 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 10 days | Sun Mar 05 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 10 days | Sun Mar 05 13:14:02 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 00:11:01 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 01:11:00 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 06:10:57 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 10:10:59 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Tue Mar 14 11:10:58 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 5 hours | Tue Mar 14 21:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 5 hours | Tue Mar 14 22:14:04 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 1 min | Wed Mar 15 02:13:05 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | @ 14 secs ago | Wed Mar 15 02:14:19 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 1 min | Wed Mar 15 03:13:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 5 hours | Wed Mar 15 03:14:01 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | @ 14 secs ago | Wed Mar 15 03:14:18 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 5 hours | Wed Mar 15 07:14:03 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 1 min | Wed Mar 15 08:13:01 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 5 hours | Wed Mar 15 08:14:02 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | @ 14 secs ago | Wed Mar 15 08:14:15 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 1 min | Wed Mar 15 12:13:03 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | @ 14 secs ago | Wed Mar 15 12:14:17 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 1 min | Wed Mar 15 13:13:02 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | @ 14 secs ago | Wed Mar 15 13:14:16 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons 12 hours | Mon Jul 31 05:32:01 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 5 mons | Mon Jul 31 17:32:01 2000 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons 12 hours | Tue Aug 01 05:32:01 2000 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 5 mons | Tue Aug 01 17:32:01 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 3 mons | Sat Sep 30 17:32:01 2000 PDT
- | Mon Jan 01 17:32:01 2001 PST | @ 3 mons | Sun Oct 01 17:32:01 2000 PDT
- | Sun Dec 31 17:32:01 2000 PST | @ 10 days | Thu Dec 21 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 10 days | Fri Dec 22 17:32:01 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 day 2 hours 3 mins 4 secs | Sat Dec 30 15:28:57 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 5 hours | Sun Dec 31 12:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 day 2 hours 3 mins 4 secs | Sun Dec 31 15:28:57 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 1 min | Sun Dec 31 17:31:01 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | @ 14 secs ago | Sun Dec 31 17:32:15 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 5 hours | Mon Jan 01 12:32:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 1 min | Mon Jan 01 17:31:01 2001 PST
- | Mon Jan 01 17:32:01 2001 PST | @ 14 secs ago | Mon Jan 01 17:32:15 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons 12 hours | Sun Apr 22 06:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 mons | Sun Apr 22 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 3 mons | Fri Jun 22 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 10 days | Wed Sep 12 18:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 day 2 hours 3 mins 4 secs | Fri Sep 21 16:16:16 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 5 hours | Sat Sep 22 13:19:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 1 min | Sat Sep 22 18:18:20 2001 PDT
- | Sat Sep 22 18:19:20 2001 PDT | @ 14 secs ago | Sat Sep 22 18:19:34 2001 PDT
-(160 rows)
-
-SELECT '' AS "16", d.f1 AS "timestamp",
- timestamp with time zone '1980-01-06 00:00 GMT' AS gpstime_zero,
- d.f1 - timestamp with time zone '1980-01-06 00:00 GMT' AS difference
- FROM TEMP_TIMESTAMP d
- ORDER BY difference;
- 16 | timestamp | gpstime_zero | difference
-----+------------------------------+------------------------------+-------------------------------------
- | Thu Jan 01 00:00:00 1970 PST | Sat Jan 05 16:00:00 1980 PST | @ 3656 days 16 hours ago
- | Wed Feb 28 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 5898 days 1 hour 32 mins 1 sec
- | Thu Feb 29 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 5899 days 1 hour 32 mins 1 sec
- | Fri Mar 01 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 5900 days 1 hour 32 mins 1 sec
- | Mon Dec 30 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 6204 days 1 hour 32 mins 1 sec
- | Tue Dec 31 17:32:01 1996 PST | Sat Jan 05 16:00:00 1980 PST | @ 6205 days 1 hour 32 mins 1 sec
- | Fri Dec 31 17:32:01 1999 PST | Sat Jan 05 16:00:00 1980 PST | @ 7300 days 1 hour 32 mins 1 sec
- | Sat Jan 01 17:32:01 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7301 days 1 hour 32 mins 1 sec
- | Wed Mar 15 02:14:05 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 10 hours 14 mins 5 secs
- | Wed Mar 15 03:14:04 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 11 hours 14 mins 4 secs
- | Wed Mar 15 08:14:01 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 16 hours 14 mins 1 sec
- | Wed Mar 15 12:14:03 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 20 hours 14 mins 3 secs
- | Wed Mar 15 13:14:02 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7374 days 21 hours 14 mins 2 secs
- | Sun Dec 31 17:32:01 2000 PST | Sat Jan 05 16:00:00 1980 PST | @ 7666 days 1 hour 32 mins 1 sec
- | Mon Jan 01 17:32:01 2001 PST | Sat Jan 05 16:00:00 1980 PST | @ 7667 days 1 hour 32 mins 1 sec
- | Sat Sep 22 18:19:20 2001 PDT | Sat Jan 05 16:00:00 1980 PST | @ 7931 days 1 hour 19 mins 20 secs
-(16 rows)
-
-SELECT '' AS "226", d1.f1 AS timestamp1, d2.f1 AS timestamp2, d1.f1 - d2.f1 AS difference
- FROM TEMP_TIMESTAMP d1, TEMP_TIMESTAMP d2
- ORDER BY timestamp1, timestamp2, difference;
- 226 | timestamp1 | timestamp2 | difference
------+------------------------------+------------------------------+-------------------------------------------
- | Thu Jan 01 00:00:00 1970 PST | Thu Jan 01 00:00:00 1970 PST | @ 0
- | Thu Jan 01 00:00:00 1970 PST | Wed Feb 28 17:32:01 1996 PST | @ 9554 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Thu Feb 29 17:32:01 1996 PST | @ 9555 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Fri Mar 01 17:32:01 1996 PST | @ 9556 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Mon Dec 30 17:32:01 1996 PST | @ 9860 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Tue Dec 31 17:32:01 1996 PST | @ 9861 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Fri Dec 31 17:32:01 1999 PST | @ 10956 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Sat Jan 01 17:32:01 2000 PST | @ 10957 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 02:14:05 2000 PST | @ 11031 days 2 hours 14 mins 5 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 03:14:04 2000 PST | @ 11031 days 3 hours 14 mins 4 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 08:14:01 2000 PST | @ 11031 days 8 hours 14 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 12:14:03 2000 PST | @ 11031 days 12 hours 14 mins 3 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Wed Mar 15 13:14:02 2000 PST | @ 11031 days 13 hours 14 mins 2 secs ago
- | Thu Jan 01 00:00:00 1970 PST | Sun Dec 31 17:32:01 2000 PST | @ 11322 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Mon Jan 01 17:32:01 2001 PST | @ 11323 days 17 hours 32 mins 1 sec ago
- | Thu Jan 01 00:00:00 1970 PST | Sat Sep 22 18:19:20 2001 PDT | @ 11587 days 17 hours 19 mins 20 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9554 days 17 hours 32 mins 1 sec
- | Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 0
- | Wed Feb 28 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 1 day ago
- | Wed Feb 28 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 2 days ago
- | Wed Feb 28 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 306 days ago
- | Wed Feb 28 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 307 days ago
- | Wed Feb 28 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1402 days ago
- | Wed Feb 28 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1403 days ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1476 days 8 hours 42 mins 4 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1476 days 9 hours 42 mins 3 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1476 days 14 hours 42 mins ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1476 days 18 hours 42 mins 2 secs ago
- | Wed Feb 28 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1476 days 19 hours 42 mins 1 sec ago
- | Wed Feb 28 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1768 days ago
- | Wed Feb 28 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1769 days ago
- | Wed Feb 28 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 2032 days 23 hours 47 mins 19 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9555 days 17 hours 32 mins 1 sec
- | Thu Feb 29 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 1 day
- | Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 0
- | Thu Feb 29 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 1 day ago
- | Thu Feb 29 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 305 days ago
- | Thu Feb 29 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 306 days ago
- | Thu Feb 29 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1401 days ago
- | Thu Feb 29 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1402 days ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1475 days 8 hours 42 mins 4 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1475 days 9 hours 42 mins 3 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1475 days 14 hours 42 mins ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1475 days 18 hours 42 mins 2 secs ago
- | Thu Feb 29 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1475 days 19 hours 42 mins 1 sec ago
- | Thu Feb 29 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1767 days ago
- | Thu Feb 29 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1768 days ago
- | Thu Feb 29 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 2031 days 23 hours 47 mins 19 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9556 days 17 hours 32 mins 1 sec
- | Fri Mar 01 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 2 days
- | Fri Mar 01 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 1 day
- | Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 0
- | Fri Mar 01 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 304 days ago
- | Fri Mar 01 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 305 days ago
- | Fri Mar 01 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1400 days ago
- | Fri Mar 01 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1401 days ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1474 days 8 hours 42 mins 4 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1474 days 9 hours 42 mins 3 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1474 days 14 hours 42 mins ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1474 days 18 hours 42 mins 2 secs ago
- | Fri Mar 01 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1474 days 19 hours 42 mins 1 sec ago
- | Fri Mar 01 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1766 days ago
- | Fri Mar 01 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1767 days ago
- | Fri Mar 01 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 2030 days 23 hours 47 mins 19 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9860 days 17 hours 32 mins 1 sec
- | Mon Dec 30 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 306 days
- | Mon Dec 30 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 305 days
- | Mon Dec 30 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 304 days
- | Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 0
- | Mon Dec 30 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 1 day ago
- | Mon Dec 30 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1096 days ago
- | Mon Dec 30 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1097 days ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1170 days 8 hours 42 mins 4 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1170 days 9 hours 42 mins 3 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1170 days 14 hours 42 mins ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1170 days 18 hours 42 mins 2 secs ago
- | Mon Dec 30 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1170 days 19 hours 42 mins 1 sec ago
- | Mon Dec 30 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1462 days ago
- | Mon Dec 30 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1463 days ago
- | Mon Dec 30 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 1726 days 23 hours 47 mins 19 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Thu Jan 01 00:00:00 1970 PST | @ 9861 days 17 hours 32 mins 1 sec
- | Tue Dec 31 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | @ 307 days
- | Tue Dec 31 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | @ 306 days
- | Tue Dec 31 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | @ 305 days
- | Tue Dec 31 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | @ 1 day
- | Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | @ 0
- | Tue Dec 31 17:32:01 1996 PST | Fri Dec 31 17:32:01 1999 PST | @ 1095 days ago
- | Tue Dec 31 17:32:01 1996 PST | Sat Jan 01 17:32:01 2000 PST | @ 1096 days ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 02:14:05 2000 PST | @ 1169 days 8 hours 42 mins 4 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 03:14:04 2000 PST | @ 1169 days 9 hours 42 mins 3 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 08:14:01 2000 PST | @ 1169 days 14 hours 42 mins ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 12:14:03 2000 PST | @ 1169 days 18 hours 42 mins 2 secs ago
- | Tue Dec 31 17:32:01 1996 PST | Wed Mar 15 13:14:02 2000 PST | @ 1169 days 19 hours 42 mins 1 sec ago
- | Tue Dec 31 17:32:01 1996 PST | Sun Dec 31 17:32:01 2000 PST | @ 1461 days ago
- | Tue Dec 31 17:32:01 1996 PST | Mon Jan 01 17:32:01 2001 PST | @ 1462 days ago
- | Tue Dec 31 17:32:01 1996 PST | Sat Sep 22 18:19:20 2001 PDT | @ 1725 days 23 hours 47 mins 19 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Thu Jan 01 00:00:00 1970 PST | @ 10956 days 17 hours 32 mins 1 sec
- | Fri Dec 31 17:32:01 1999 PST | Wed Feb 28 17:32:01 1996 PST | @ 1402 days
- | Fri Dec 31 17:32:01 1999 PST | Thu Feb 29 17:32:01 1996 PST | @ 1401 days
- | Fri Dec 31 17:32:01 1999 PST | Fri Mar 01 17:32:01 1996 PST | @ 1400 days
- | Fri Dec 31 17:32:01 1999 PST | Mon Dec 30 17:32:01 1996 PST | @ 1096 days
- | Fri Dec 31 17:32:01 1999 PST | Tue Dec 31 17:32:01 1996 PST | @ 1095 days
- | Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST | @ 0
- | Fri Dec 31 17:32:01 1999 PST | Sat Jan 01 17:32:01 2000 PST | @ 1 day ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 02:14:05 2000 PST | @ 74 days 8 hours 42 mins 4 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 03:14:04 2000 PST | @ 74 days 9 hours 42 mins 3 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 08:14:01 2000 PST | @ 74 days 14 hours 42 mins ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 12:14:03 2000 PST | @ 74 days 18 hours 42 mins 2 secs ago
- | Fri Dec 31 17:32:01 1999 PST | Wed Mar 15 13:14:02 2000 PST | @ 74 days 19 hours 42 mins 1 sec ago
- | Fri Dec 31 17:32:01 1999 PST | Sun Dec 31 17:32:01 2000 PST | @ 366 days ago
- | Fri Dec 31 17:32:01 1999 PST | Mon Jan 01 17:32:01 2001 PST | @ 367 days ago
- | Fri Dec 31 17:32:01 1999 PST | Sat Sep 22 18:19:20 2001 PDT | @ 630 days 23 hours 47 mins 19 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 10957 days 17 hours 32 mins 1 sec
- | Sat Jan 01 17:32:01 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1403 days
- | Sat Jan 01 17:32:01 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1402 days
- | Sat Jan 01 17:32:01 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1401 days
- | Sat Jan 01 17:32:01 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1097 days
- | Sat Jan 01 17:32:01 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1096 days
- | Sat Jan 01 17:32:01 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 1 day
- | Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 0
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 73 days 8 hours 42 mins 4 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 73 days 9 hours 42 mins 3 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 73 days 14 hours 42 mins ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 73 days 18 hours 42 mins 2 secs ago
- | Sat Jan 01 17:32:01 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 73 days 19 hours 42 mins 1 sec ago
- | Sat Jan 01 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 365 days ago
- | Sat Jan 01 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 366 days ago
- | Sat Jan 01 17:32:01 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 629 days 23 hours 47 mins 19 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 2 hours 14 mins 5 secs
- | Wed Mar 15 02:14:05 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 8 hours 42 mins 4 secs
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 0
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 59 mins 59 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 5 hours 59 mins 56 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 9 hours 59 mins 58 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 10 hours 59 mins 57 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 15 hours 17 mins 56 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 15 hours 17 mins 56 secs ago
- | Wed Mar 15 02:14:05 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 15 hours 5 mins 15 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 3 hours 14 mins 4 secs
- | Wed Mar 15 03:14:04 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 9 hours 42 mins 3 secs
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 59 mins 59 secs
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 0
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 4 hours 59 mins 57 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 8 hours 59 mins 59 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 9 hours 59 mins 58 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 14 hours 17 mins 57 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 14 hours 17 mins 57 secs ago
- | Wed Mar 15 03:14:04 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 14 hours 5 mins 16 secs ago
- | Wed Mar 15 08:14:01 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 8 hours 14 mins 1 sec
- | Wed Mar 15 08:14:01 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 14 hours 42 mins
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 5 hours 59 mins 56 secs
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 4 hours 59 mins 57 secs
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 0
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 4 hours 2 secs ago
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 5 hours 1 sec ago
- | Wed Mar 15 08:14:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 9 hours 18 mins ago
- | Wed Mar 15 08:14:01 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 9 hours 18 mins ago
- | Wed Mar 15 08:14:01 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 9 hours 5 mins 19 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 12 hours 14 mins 3 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 18 hours 42 mins 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 9 hours 59 mins 58 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 8 hours 59 mins 59 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 4 hours 2 secs
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 0
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 59 mins 59 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 5 hours 17 mins 58 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 5 hours 17 mins 58 secs ago
- | Wed Mar 15 12:14:03 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 5 hours 5 mins 17 secs ago
- | Wed Mar 15 13:14:02 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11031 days 13 hours 14 mins 2 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1476 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1475 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1474 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1170 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1169 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 74 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 73 days 19 hours 42 mins 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 10 hours 59 mins 57 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 9 hours 59 mins 58 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 5 hours 1 sec
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 59 mins 59 secs
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 0
- | Wed Mar 15 13:14:02 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 291 days 4 hours 17 mins 59 secs ago
- | Wed Mar 15 13:14:02 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 292 days 4 hours 17 mins 59 secs ago
- | Wed Mar 15 13:14:02 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 556 days 4 hours 5 mins 18 secs ago
- | Sun Dec 31 17:32:01 2000 PST | Thu Jan 01 00:00:00 1970 PST | @ 11322 days 17 hours 32 mins 1 sec
- | Sun Dec 31 17:32:01 2000 PST | Wed Feb 28 17:32:01 1996 PST | @ 1768 days
- | Sun Dec 31 17:32:01 2000 PST | Thu Feb 29 17:32:01 1996 PST | @ 1767 days
- | Sun Dec 31 17:32:01 2000 PST | Fri Mar 01 17:32:01 1996 PST | @ 1766 days
- | Sun Dec 31 17:32:01 2000 PST | Mon Dec 30 17:32:01 1996 PST | @ 1462 days
- | Sun Dec 31 17:32:01 2000 PST | Tue Dec 31 17:32:01 1996 PST | @ 1461 days
- | Sun Dec 31 17:32:01 2000 PST | Fri Dec 31 17:32:01 1999 PST | @ 366 days
- | Sun Dec 31 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST | @ 365 days
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 02:14:05 2000 PST | @ 291 days 15 hours 17 mins 56 secs
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 03:14:04 2000 PST | @ 291 days 14 hours 17 mins 57 secs
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 08:14:01 2000 PST | @ 291 days 9 hours 18 mins
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 12:14:03 2000 PST | @ 291 days 5 hours 17 mins 58 secs
- | Sun Dec 31 17:32:01 2000 PST | Wed Mar 15 13:14:02 2000 PST | @ 291 days 4 hours 17 mins 59 secs
- | Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | @ 0
- | Sun Dec 31 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST | @ 1 day ago
- | Sun Dec 31 17:32:01 2000 PST | Sat Sep 22 18:19:20 2001 PDT | @ 264 days 23 hours 47 mins 19 secs ago
- | Mon Jan 01 17:32:01 2001 PST | Thu Jan 01 00:00:00 1970 PST | @ 11323 days 17 hours 32 mins 1 sec
- | Mon Jan 01 17:32:01 2001 PST | Wed Feb 28 17:32:01 1996 PST | @ 1769 days
- | Mon Jan 01 17:32:01 2001 PST | Thu Feb 29 17:32:01 1996 PST | @ 1768 days
- | Mon Jan 01 17:32:01 2001 PST | Fri Mar 01 17:32:01 1996 PST | @ 1767 days
- | Mon Jan 01 17:32:01 2001 PST | Mon Dec 30 17:32:01 1996 PST | @ 1463 days
- | Mon Jan 01 17:32:01 2001 PST | Tue Dec 31 17:32:01 1996 PST | @ 1462 days
- | Mon Jan 01 17:32:01 2001 PST | Fri Dec 31 17:32:01 1999 PST | @ 367 days
- | Mon Jan 01 17:32:01 2001 PST | Sat Jan 01 17:32:01 2000 PST | @ 366 days
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 02:14:05 2000 PST | @ 292 days 15 hours 17 mins 56 secs
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 03:14:04 2000 PST | @ 292 days 14 hours 17 mins 57 secs
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 08:14:01 2000 PST | @ 292 days 9 hours 18 mins
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 12:14:03 2000 PST | @ 292 days 5 hours 17 mins 58 secs
- | Mon Jan 01 17:32:01 2001 PST | Wed Mar 15 13:14:02 2000 PST | @ 292 days 4 hours 17 mins 59 secs
- | Mon Jan 01 17:32:01 2001 PST | Sun Dec 31 17:32:01 2000 PST | @ 1 day
- | Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST | @ 0
- | Mon Jan 01 17:32:01 2001 PST | Sat Sep 22 18:19:20 2001 PDT | @ 263 days 23 hours 47 mins 19 secs ago
- | Sat Sep 22 18:19:20 2001 PDT | Thu Jan 01 00:00:00 1970 PST | @ 11587 days 17 hours 19 mins 20 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Feb 28 17:32:01 1996 PST | @ 2032 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Thu Feb 29 17:32:01 1996 PST | @ 2031 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Fri Mar 01 17:32:01 1996 PST | @ 2030 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Mon Dec 30 17:32:01 1996 PST | @ 1726 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Tue Dec 31 17:32:01 1996 PST | @ 1725 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Fri Dec 31 17:32:01 1999 PST | @ 630 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Sat Jan 01 17:32:01 2000 PST | @ 629 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 02:14:05 2000 PST | @ 556 days 15 hours 5 mins 15 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 03:14:04 2000 PST | @ 556 days 14 hours 5 mins 16 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 08:14:01 2000 PST | @ 556 days 9 hours 5 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 12:14:03 2000 PST | @ 556 days 5 hours 5 mins 17 secs
- | Sat Sep 22 18:19:20 2001 PDT | Wed Mar 15 13:14:02 2000 PST | @ 556 days 4 hours 5 mins 18 secs
- | Sat Sep 22 18:19:20 2001 PDT | Sun Dec 31 17:32:01 2000 PST | @ 264 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Mon Jan 01 17:32:01 2001 PST | @ 263 days 23 hours 47 mins 19 secs
- | Sat Sep 22 18:19:20 2001 PDT | Sat Sep 22 18:19:20 2001 PDT | @ 0
-(256 rows)
-
---
--- abstime, reltime arithmetic
---
-SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime
- WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1) < abstime 'Jan 14 14:00:00 1971'
- ORDER BY abstime, reltime;
- ten | abstime | reltime
------+------------------------------+---------------
- | Sat May 10 23:59:12 1947 PDT | @ 14 secs ago
- | Sat May 10 23:59:12 1947 PDT | @ 1 min
- | Sat May 10 23:59:12 1947 PDT | @ 5 hours
- | Sat May 10 23:59:12 1947 PDT | @ 10 days
- | Sat May 10 23:59:12 1947 PDT | @ 3 mons
- | Wed Dec 31 16:00:00 1969 PST | @ 14 secs ago
- | Wed Dec 31 16:00:00 1969 PST | @ 1 min
- | Wed Dec 31 16:00:00 1969 PST | @ 5 hours
- | Wed Dec 31 16:00:00 1969 PST | @ 10 days
- | Wed Dec 31 16:00:00 1969 PST | @ 3 mons
-(10 rows)
-
--- these four queries should return the same answer
--- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and
--- therefore, should not show up in the results.
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years
- < abstime 'Jan 14 14:00:00 1977';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PDT
-(3 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years
- < abstime 'Jan 14 14:00:00 1971';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PDT
-(3 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years
- < abstime 'Jan 14 14:00:00 1971';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PDT
-(3 rows)
-
-SELECT '' AS three, ABSTIME_TBL.*
- WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years
- < abstime 'Jan 14 14:00:00 1977';
- three | f1
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Wed Dec 31 16:00:00 1969 PST
- | Sat May 10 23:59:12 1947 PDT
-(3 rows)
-
---
--- Conversions
---
-SELECT '' AS "16", f1 AS "timestamp", date(f1) AS date
- FROM TEMP_TIMESTAMP
- WHERE f1 <> timestamp 'now'
- ORDER BY date, "timestamp";
- 16 | timestamp | date
-----+------------------------------+------------
- | Thu Jan 01 00:00:00 1970 PST | 01-01-1970
- | Wed Feb 28 17:32:01 1996 PST | 02-28-1996
- | Thu Feb 29 17:32:01 1996 PST | 02-29-1996
- | Fri Mar 01 17:32:01 1996 PST | 03-01-1996
- | Mon Dec 30 17:32:01 1996 PST | 12-30-1996
- | Tue Dec 31 17:32:01 1996 PST | 12-31-1996
- | Fri Dec 31 17:32:01 1999 PST | 12-31-1999
- | Sat Jan 01 17:32:01 2000 PST | 01-01-2000
- | Wed Mar 15 02:14:05 2000 PST | 03-15-2000
- | Wed Mar 15 03:14:04 2000 PST | 03-15-2000
- | Wed Mar 15 08:14:01 2000 PST | 03-15-2000
- | Wed Mar 15 12:14:03 2000 PST | 03-15-2000
- | Wed Mar 15 13:14:02 2000 PST | 03-15-2000
- | Sun Dec 31 17:32:01 2000 PST | 12-31-2000
- | Mon Jan 01 17:32:01 2001 PST | 01-01-2001
- | Sat Sep 22 18:19:20 2001 PDT | 09-22-2001
-(16 rows)
-
-SELECT '' AS "16", f1 AS "timestamp", abstime(f1) AS abstime
- FROM TEMP_TIMESTAMP
- ORDER BY abstime;
- 16 | timestamp | abstime
-----+------------------------------+------------------------------
- | Thu Jan 01 00:00:00 1970 PST | Thu Jan 01 00:00:00 1970 PST
- | Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
- | Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST
- | Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
- | Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
- | Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
- | Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
- | Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
- | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 02:14:05 2000 PST
- | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 03:14:04 2000 PST
- | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 08:14:01 2000 PST
- | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 12:14:03 2000 PST
- | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 13:14:02 2000 PST
- | Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST
- | Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
- | Sat Sep 22 18:19:20 2001 PDT | Sat Sep 22 18:19:20 2001 PDT
-(16 rows)
-
-SELECT '' AS four, f1 AS abstime, date(f1) AS date
- FROM ABSTIME_TBL
- WHERE isfinite(f1) AND f1 <> abstime 'now'
- ORDER BY date, abstime;
- four | abstime | date
-------+------------------------------+------------
- | Sat May 10 23:59:12 1947 PDT | 05-10-1947
- | Wed Dec 31 16:00:00 1969 PST | 12-31-1969
- | Sun Jan 14 03:14:21 1973 PST | 01-14-1973
- | Mon May 01 00:30:30 1995 PDT | 05-01-1995
-(4 rows)
-
-SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime
- FROM TIMESTAMP_TBL WHERE NOT isfinite(d1);
- two | timestamp | abstime
------+-----------+-----------
- | -infinity | -infinity
- | infinity | infinity
-(2 rows)
-
-SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp"
- FROM ABSTIME_TBL WHERE NOT isfinite(f1);
-ERROR: cannot convert abstime "invalid" to timestamp
-SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime
- FROM INTERVAL_TBL;
- ten | interval | reltime
------+-------------------------------+-------------------------------
- | @ 1 min | @ 1 min
- | @ 5 hours | @ 5 hours
- | @ 10 days | @ 10 days
- | @ 34 years | @ 34 years
- | @ 3 mons | @ 3 mons
- | @ 14 secs ago | @ 14 secs ago
- | @ 1 day 2 hours 3 mins 4 secs | @ 1 day 2 hours 3 mins 4 secs
- | @ 6 years | @ 6 years
- | @ 5 mons | @ 5 mons
- | @ 5 mons 12 hours | @ 5 mons 12 hours
-(10 rows)
-
-SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval
- FROM RELTIME_TBL;
- six | reltime | interval
------+---------------+---------------
- | @ 1 min | @ 1 min
- | @ 5 hours | @ 5 hours
- | @ 10 days | @ 10 days
- | @ 34 years | @ 34 years
- | @ 3 mons | @ 3 mons
- | @ 14 secs ago | @ 14 secs ago
-(6 rows)
-
-DROP TABLE TEMP_TIMESTAMP;
---
--- Formats
---
-SET DateStyle TO 'US,Postgres';
-SHOW DateStyle;
- DateStyle
----------------
- Postgres, MDY
-(1 row)
-
-SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
- 64 | us_postgres
-----+-----------------------------
- | -infinity
- | infinity
- | Thu Jan 01 00:00:00 1970
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:02 1997
- | Mon Feb 10 17:32:01.40 1997
- | Mon Feb 10 17:32:01.50 1997
- | Mon Feb 10 17:32:01.60 1997
- | Thu Jan 02 00:00:00 1997
- | Thu Jan 02 03:04:05 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Tue Jun 10 17:32:01 1997
- | Sat Sep 22 18:19:20 2001
- | Wed Mar 15 08:14:01 2000
- | Wed Mar 15 13:14:02 2000
- | Wed Mar 15 12:14:03 2000
- | Wed Mar 15 03:14:04 2000
- | Wed Mar 15 02:14:05 2000
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:00 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Tue Jun 10 18:32:01 1997
- | Mon Feb 10 17:32:01 1997
- | Tue Feb 11 17:32:01 1997
- | Wed Feb 12 17:32:01 1997
- | Thu Feb 13 17:32:01 1997
- | Fri Feb 14 17:32:01 1997
- | Sat Feb 15 17:32:01 1997
- | Sun Feb 16 17:32:01 1997
- | Tue Feb 16 17:32:01 0097 BC
- | Sat Feb 16 17:32:01 0097
- | Thu Feb 16 17:32:01 0597
- | Tue Feb 16 17:32:01 1097
- | Sat Feb 16 17:32:01 1697
- | Thu Feb 16 17:32:01 1797
- | Tue Feb 16 17:32:01 1897
- | Sun Feb 16 17:32:01 1997
- | Sat Feb 16 17:32:01 2097
- | Wed Feb 28 17:32:01 1996
- | Thu Feb 29 17:32:01 1996
- | Fri Mar 01 17:32:01 1996
- | Mon Dec 30 17:32:01 1996
- | Tue Dec 31 17:32:01 1996
- | Wed Jan 01 17:32:01 1997
- | Fri Feb 28 17:32:01 1997
- | Sat Mar 01 17:32:01 1997
- | Tue Dec 30 17:32:01 1997
- | Wed Dec 31 17:32:01 1997
- | Fri Dec 31 17:32:01 1999
- | Sat Jan 01 17:32:01 2000
- | Sun Dec 31 17:32:01 2000
- | Mon Jan 01 17:32:01 2001
-(64 rows)
-
-SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL;
- seven | us_postgres
--------+------------------------------
- | Sun Jan 14 03:14:21 1973 PST
- | Mon May 01 00:30:30 1995 PDT
- | Wed Dec 31 16:00:00 1969 PST
- | infinity
- | -infinity
- | Sat May 10 23:59:12 1947 PDT
- | invalid
-(7 rows)
-
-SET DateStyle TO 'US,ISO';
-SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL;
- 64 | us_iso
-----+------------------------
- | -infinity
- | infinity
- | 1970-01-01 00:00:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:02
- | 1997-02-10 17:32:01.40
- | 1997-02-10 17:32:01.50
- | 1997-02-10 17:32:01.60
- | 1997-01-02 00:00:00
- | 1997-01-02 03:04:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 17:32:01
- | 2001-09-22 18:19:20
- | 2000-03-15 08:14:01
- | 2000-03-15 13:14:02
- | 2000-03-15 12:14:03
- | 2000-03-15 03:14:04
- | 2000-03-15 02:14:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 18:32:01
- | 1997-02-10 17:32:01
- | 1997-02-11 17:32:01
- | 1997-02-12 17:32:01
- | 1997-02-13 17:32:01
- | 1997-02-14 17:32:01
- | 1997-02-15 17:32:01
- | 1997-02-16 17:32:01
- | 0097-02-16 17:32:01 BC
- | 0097-02-16 17:32:01
- | 0597-02-16 17:32:01
- | 1097-02-16 17:32:01
- | 1697-02-16 17:32:01
- | 1797-02-16 17:32:01
- | 1897-02-16 17:32:01
- | 1997-02-16 17:32:01
- | 2097-02-16 17:32:01
- | 1996-02-28 17:32:01
- | 1996-02-29 17:32:01
- | 1996-03-01 17:32:01
- | 1996-12-30 17:32:01
- | 1996-12-31 17:32:01
- | 1997-01-01 17:32:01
- | 1997-02-28 17:32:01
- | 1997-03-01 17:32:01
- | 1997-12-30 17:32:01
- | 1997-12-31 17:32:01
- | 1999-12-31 17:32:01
- | 2000-01-01 17:32:01
- | 2000-12-31 17:32:01
- | 2001-01-01 17:32:01
-(64 rows)
-
-SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
- seven | us_iso
--------+------------------------
- | 1973-01-14 03:14:21-08
- | 1995-05-01 00:30:30-07
- | 1969-12-31 16:00:00-08
- | infinity
- | -infinity
- | 1947-05-10 23:59:12-07
- | invalid
-(7 rows)
-
-SET DateStyle TO 'US,SQL';
-SHOW DateStyle;
- DateStyle
------------
- SQL, MDY
-(1 row)
-
-SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
- 64 | us_sql
-----+------------------------
- | -infinity
- | infinity
- | 01/01/1970 00:00:00
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:02
- | 02/10/1997 17:32:01.40
- | 02/10/1997 17:32:01.50
- | 02/10/1997 17:32:01.60
- | 01/02/1997 00:00:00
- | 01/02/1997 03:04:05
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 06/10/1997 17:32:01
- | 09/22/2001 18:19:20
- | 03/15/2000 08:14:01
- | 03/15/2000 13:14:02
- | 03/15/2000 12:14:03
- | 03/15/2000 03:14:04
- | 03/15/2000 02:14:05
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:00
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 02/10/1997 17:32:01
- | 06/10/1997 18:32:01
- | 02/10/1997 17:32:01
- | 02/11/1997 17:32:01
- | 02/12/1997 17:32:01
- | 02/13/1997 17:32:01
- | 02/14/1997 17:32:01
- | 02/15/1997 17:32:01
- | 02/16/1997 17:32:01
- | 02/16/0097 17:32:01 BC
- | 02/16/0097 17:32:01
- | 02/16/0597 17:32:01
- | 02/16/1097 17:32:01
- | 02/16/1697 17:32:01
- | 02/16/1797 17:32:01
- | 02/16/1897 17:32:01
- | 02/16/1997 17:32:01
- | 02/16/2097 17:32:01
- | 02/28/1996 17:32:01
- | 02/29/1996 17:32:01
- | 03/01/1996 17:32:01
- | 12/30/1996 17:32:01
- | 12/31/1996 17:32:01
- | 01/01/1997 17:32:01
- | 02/28/1997 17:32:01
- | 03/01/1997 17:32:01
- | 12/30/1997 17:32:01
- | 12/31/1997 17:32:01
- | 12/31/1999 17:32:01
- | 01/01/2000 17:32:01
- | 12/31/2000 17:32:01
- | 01/01/2001 17:32:01
-(64 rows)
-
-SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
- seven | us_sql
--------+-------------------------
- | 01/14/1973 03:14:21 PST
- | 05/01/1995 00:30:30 PDT
- | 12/31/1969 16:00:00 PST
- | infinity
- | -infinity
- | 05/10/1947 23:59:12 PDT
- | invalid
-(7 rows)
-
-SET DateStyle TO 'European,Postgres';
-SHOW DateStyle;
- DateStyle
----------------
- Postgres, DMY
-(1 row)
-
-INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
-SELECT count(*) as one FROM TIMESTAMP_TBL WHERE d1 = 'Jun 13 1957';
- one
------
- 1
-(1 row)
-
-SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL;
- 65 | european_postgres
-----+-----------------------------
- | -infinity
- | infinity
- | Thu 01 Jan 00:00:00 1970
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:02 1997
- | Mon 10 Feb 17:32:01.40 1997
- | Mon 10 Feb 17:32:01.50 1997
- | Mon 10 Feb 17:32:01.60 1997
- | Thu 02 Jan 00:00:00 1997
- | Thu 02 Jan 03:04:05 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Tue 10 Jun 17:32:01 1997
- | Sat 22 Sep 18:19:20 2001
- | Wed 15 Mar 08:14:01 2000
- | Wed 15 Mar 13:14:02 2000
- | Wed 15 Mar 12:14:03 2000
- | Wed 15 Mar 03:14:04 2000
- | Wed 15 Mar 02:14:05 2000
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:00 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Tue 10 Jun 18:32:01 1997
- | Mon 10 Feb 17:32:01 1997
- | Tue 11 Feb 17:32:01 1997
- | Wed 12 Feb 17:32:01 1997
- | Thu 13 Feb 17:32:01 1997
- | Fri 14 Feb 17:32:01 1997
- | Sat 15 Feb 17:32:01 1997
- | Sun 16 Feb 17:32:01 1997
- | Tue 16 Feb 17:32:01 0097 BC
- | Sat 16 Feb 17:32:01 0097
- | Thu 16 Feb 17:32:01 0597
- | Tue 16 Feb 17:32:01 1097
- | Sat 16 Feb 17:32:01 1697
- | Thu 16 Feb 17:32:01 1797
- | Tue 16 Feb 17:32:01 1897
- | Sun 16 Feb 17:32:01 1997
- | Sat 16 Feb 17:32:01 2097
- | Wed 28 Feb 17:32:01 1996
- | Thu 29 Feb 17:32:01 1996
- | Fri 01 Mar 17:32:01 1996
- | Mon 30 Dec 17:32:01 1996
- | Tue 31 Dec 17:32:01 1996
- | Wed 01 Jan 17:32:01 1997
- | Fri 28 Feb 17:32:01 1997
- | Sat 01 Mar 17:32:01 1997
- | Tue 30 Dec 17:32:01 1997
- | Wed 31 Dec 17:32:01 1997
- | Fri 31 Dec 17:32:01 1999
- | Sat 01 Jan 17:32:01 2000
- | Sun 31 Dec 17:32:01 2000
- | Mon 01 Jan 17:32:01 2001
- | Thu 13 Jun 00:00:00 1957
-(65 rows)
-
-SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
- seven | european_postgres
--------+------------------------------
- | Sun 14 Jan 03:14:21 1973 PST
- | Mon 01 May 00:30:30 1995 PDT
- | Wed 31 Dec 16:00:00 1969 PST
- | infinity
- | -infinity
- | Sat 10 May 23:59:12 1947 PDT
- | invalid
-(7 rows)
-
-SET DateStyle TO 'European,ISO';
-SHOW DateStyle;
- DateStyle
------------
- ISO, DMY
-(1 row)
-
-SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
- 65 | european_iso
-----+------------------------
- | -infinity
- | infinity
- | 1970-01-01 00:00:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:02
- | 1997-02-10 17:32:01.40
- | 1997-02-10 17:32:01.50
- | 1997-02-10 17:32:01.60
- | 1997-01-02 00:00:00
- | 1997-01-02 03:04:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 17:32:01
- | 2001-09-22 18:19:20
- | 2000-03-15 08:14:01
- | 2000-03-15 13:14:02
- | 2000-03-15 12:14:03
- | 2000-03-15 03:14:04
- | 2000-03-15 02:14:05
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:00
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-02-10 17:32:01
- | 1997-06-10 18:32:01
- | 1997-02-10 17:32:01
- | 1997-02-11 17:32:01
- | 1997-02-12 17:32:01
- | 1997-02-13 17:32:01
- | 1997-02-14 17:32:01
- | 1997-02-15 17:32:01
- | 1997-02-16 17:32:01
- | 0097-02-16 17:32:01 BC
- | 0097-02-16 17:32:01
- | 0597-02-16 17:32:01
- | 1097-02-16 17:32:01
- | 1697-02-16 17:32:01
- | 1797-02-16 17:32:01
- | 1897-02-16 17:32:01
- | 1997-02-16 17:32:01
- | 2097-02-16 17:32:01
- | 1996-02-28 17:32:01
- | 1996-02-29 17:32:01
- | 1996-03-01 17:32:01
- | 1996-12-30 17:32:01
- | 1996-12-31 17:32:01
- | 1997-01-01 17:32:01
- | 1997-02-28 17:32:01
- | 1997-03-01 17:32:01
- | 1997-12-30 17:32:01
- | 1997-12-31 17:32:01
- | 1999-12-31 17:32:01
- | 2000-01-01 17:32:01
- | 2000-12-31 17:32:01
- | 2001-01-01 17:32:01
- | 1957-06-13 00:00:00
-(65 rows)
-
-SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
- seven | european_iso
--------+------------------------
- | 1973-01-14 03:14:21-08
- | 1995-05-01 00:30:30-07
- | 1969-12-31 16:00:00-08
- | infinity
- | -infinity
- | 1947-05-10 23:59:12-07
- | invalid
-(7 rows)
-
-SET DateStyle TO 'European,SQL';
-SHOW DateStyle;
- DateStyle
------------
- SQL, DMY
-(1 row)
-
-SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
- 65 | european_sql
-----+------------------------
- | -infinity
- | infinity
- | 01/01/1970 00:00:00
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:02
- | 10/02/1997 17:32:01.40
- | 10/02/1997 17:32:01.50
- | 10/02/1997 17:32:01.60
- | 02/01/1997 00:00:00
- | 02/01/1997 03:04:05
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/06/1997 17:32:01
- | 22/09/2001 18:19:20
- | 15/03/2000 08:14:01
- | 15/03/2000 13:14:02
- | 15/03/2000 12:14:03
- | 15/03/2000 03:14:04
- | 15/03/2000 02:14:05
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:00
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/02/1997 17:32:01
- | 10/06/1997 18:32:01
- | 10/02/1997 17:32:01
- | 11/02/1997 17:32:01
- | 12/02/1997 17:32:01
- | 13/02/1997 17:32:01
- | 14/02/1997 17:32:01
- | 15/02/1997 17:32:01
- | 16/02/1997 17:32:01
- | 16/02/0097 17:32:01 BC
- | 16/02/0097 17:32:01
- | 16/02/0597 17:32:01
- | 16/02/1097 17:32:01
- | 16/02/1697 17:32:01
- | 16/02/1797 17:32:01
- | 16/02/1897 17:32:01
- | 16/02/1997 17:32:01
- | 16/02/2097 17:32:01
- | 28/02/1996 17:32:01
- | 29/02/1996 17:32:01
- | 01/03/1996 17:32:01
- | 30/12/1996 17:32:01
- | 31/12/1996 17:32:01
- | 01/01/1997 17:32:01
- | 28/02/1997 17:32:01
- | 01/03/1997 17:32:01
- | 30/12/1997 17:32:01
- | 31/12/1997 17:32:01
- | 31/12/1999 17:32:01
- | 01/01/2000 17:32:01
- | 31/12/2000 17:32:01
- | 01/01/2001 17:32:01
- | 13/06/1957 00:00:00
-(65 rows)
-
-SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL;
- seven | european_sql
--------+-------------------------
- | 14/01/1973 03:14:21 PST
- | 01/05/1995 00:30:30 PDT
- | 31/12/1969 16:00:00 PST
- | infinity
- | -infinity
- | 10/05/1947 23:59:12 PDT
- | invalid
-(7 rows)
-
-RESET DateStyle;
+++ /dev/null
---
--- TINTERVAL
---
-CREATE TABLE TINTERVAL_TBL (f1 tinterval);
--- Should accept any abstime,
--- so do not bother with extensive testing of values
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["-infinity" "infinity"]');
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]');
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]');
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["epoch" "Mon May 1 00:30:30 1995"]');
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["Feb 15 1990 12:15:03" "2001-09-23 11:12:13"]');
--- badly formatted tintervals
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["bad time specifications" ""]');
-ERROR: invalid input syntax for type abstime: "bad time specifications"
-INSERT INTO TINTERVAL_TBL (f1)
- VALUES ('["" "infinity"]');
-ERROR: invalid input syntax for type abstime: ""
--- test tinterval operators
-SELECT '' AS five, TINTERVAL_TBL.*;
- five | f1
-------+-----------------------------------------------------------------
- | ["-infinity" "infinity"]
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
-(5 rows)
-
--- length ==
-SELECT '' AS one, t.*
- FROM TINTERVAL_TBL t
- WHERE t.f1 #= '@ 1 months';
- one | f1
------+-----------------------------------------------------------------
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
-(1 row)
-
--- length <>
-SELECT '' AS three, t.*
- FROM TINTERVAL_TBL t
- WHERE t.f1 #<> '@ 1 months';
- three | f1
--------+-----------------------------------------------------------------
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
-(3 rows)
-
--- length <
-SELECT '' AS zero, t.*
- FROM TINTERVAL_TBL t
- WHERE t.f1 #< '@ 1 month';
- zero | f1
-------+----
-(0 rows)
-
--- length <=
-SELECT '' AS one, t.*
- FROM TINTERVAL_TBL t
- WHERE t.f1 #<= '@ 1 month';
- one | f1
------+-----------------------------------------------------------------
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
-(1 row)
-
--- length >
-SELECT '' AS three, t.*
- FROM TINTERVAL_TBL t
- WHERE t.f1 #> '@ 1 year';
- three | f1
--------+-----------------------------------------------------------------
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
-(3 rows)
-
--- length >=
-SELECT '' AS three, t.*
- FROM TINTERVAL_TBL t
- WHERE t.f1 #>= '@ 3 years';
- three | f1
--------+-----------------------------------------------------------------
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
-(3 rows)
-
--- overlaps
-SELECT '' AS three, t1.*
- FROM TINTERVAL_TBL t1
- WHERE t1.f1 &&
- tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]';
- three | f1
--------+-----------------------------------------------------------------
- | ["-infinity" "infinity"]
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
-(3 rows)
-
-SET geqo TO 'off';
-SELECT '' AS five, t1.f1, t2.f1
- FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2
- WHERE t1.f1 && t2.f1 and
- t1.f1 = t2.f1
- ORDER BY t1.f1, t2.f1;
- five | f1 | f1
-------+-----------------------------------------------------------------+-----------------------------------------------------------------
- | ["-infinity" "infinity"] | ["-infinity" "infinity"]
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
-(5 rows)
-
-SELECT '' AS fourteen, t1.f1 AS interval1, t2.f1 AS interval2
- FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2
- WHERE t1.f1 && t2.f1 and not t1.f1 = t2.f1
- ORDER BY interval1, interval2;
- fourteen | interval1 | interval2
-----------+-----------------------------------------------------------------+-----------------------------------------------------------------
- | ["-infinity" "infinity"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["-infinity" "infinity"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
- | ["-infinity" "infinity"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["-infinity" "infinity"] | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["-infinity" "infinity"]
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] | ["-infinity" "infinity"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["-infinity" "infinity"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"] | ["-infinity" "infinity"]
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
-(14 rows)
-
--- contains
-SELECT '' AS five, t1.f1
- FROM TINTERVAL_TBL t1
- WHERE not t1.f1 <<
- tinterval '["Aug 15 14:23:19 1980" "Sep 16 14:23:19 1990"]'
- ORDER BY t1.f1;
- five | f1
-------+-----------------------------------------------------------------
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"]
- | ["Sat May 10 23:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
-(3 rows)
-
--- make time interval
-SELECT '' AS three, t1.f1
- FROM TINTERVAL_TBL t1
- WHERE t1.f1 &&
- (abstime 'Aug 15 14:23:19 1983' <#>
- abstime 'Sep 16 14:23:19 1983')
- ORDER BY t1.f1;
- three | f1
--------+-----------------------------------------------------------------
- | ["-infinity" "infinity"]
- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
- | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"]
-(3 rows)
-
-RESET geqo;
-abstime/.*-aix4=abstime-solaris-1947
-abstime/.*-aix5=abstime-solaris-1947
-abstime/alpha.*-dec-osf=abstime-solaris-1947
-abstime/.*-irix=abstime-solaris-1947
-abstime/i.86-pc-solaris=abstime-solaris-1947
-abstime/sparc-sun-solaris=abstime-solaris-1947
-abstime/.*-sco=abstime-solaris-1947
-abstime/.*-sysv5=abstime-solaris-1947
float4/.*-qnx=float4-exp-three-digits
float4/i.86-pc-mingw32=float4-exp-three-digits
float8/i.86-.*-freebsd[234]=float8-small-is-zero
float8/.*-qnx=float8-exp-three-digits
float8/i.86-pc-mingw32=float8-exp-three-digits-win32
float8/i.86-pc-cygwin=float8-small-is-zero
-horology/.*-aix4=horology-solaris-1947
-horology/.*-aix5=horology-solaris-1947
-horology/alpha.*-dec-osf=horology-solaris-1947
-horology/.*-cygwin=horology-no-DST-before-1970
-horology/.*-hpux=horology-no-DST-before-1970
-horology/.*-irix=horology-solaris-1947
-horology/i.86-pc-solaris=horology-solaris-1947
-horology/sparc-sun-solaris=horology-solaris-1947
-horology/sparc-sun-sunos4.*=horology-no-DST-before-1970
-horology/.*-sysv5=horology-solaris-1947
-horology/.*-sco=horology-solaris-1947
int8/.*-qnx=int8-exp-three-digits
int8/i.86-pc-mingw32=int8-exp-three-digits-win32
-tinterval/.*-aix4=tinterval-solaris-1947
-tinterval/.*-aix5=tinterval-solaris-1947
-tinterval/alpha.*-dec-osf=tinterval-solaris-1947
-tinterval/.*-irix=tinterval-solaris-1947
-tinterval/i.86-pc-solaris=tinterval-solaris-1947
-tinterval/sparc-sun-solaris=tinterval-solaris-1947
-tinterval/.*-sysv5=tinterval-solaris-1947
-tinterval/.*-sco=tinterval-solaris-1947
# Makefile for the timezone library
# IDENTIFICATION
-# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.9 2004/05/18 04:10:33 momjian Exp $
+# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.10 2004/05/21 05:08:06 tgl Exp $
#
#-------------------------------------------------------------------------
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
-OBJS= asctime.o difftime.o localtime.o pgtz.o
-ZICOBJS= zic.o ialloc.o scheck.o localtime.o asctime.o pgtz.o
+# files to build into backend
+OBJS= localtime.o strftime.o pgtz.o
-TZDATA := africa antarctica asia australasia europe northamerica southamerica pacificnew etcetera factory backward systemv solar87 solar88 solar89
+# files needed to build zic utility program
+ZICOBJS= zic.o ialloc.o scheck.o localtime.o
+
+# timezone data files
+TZDATA := africa antarctica asia australasia europe northamerica southamerica \
+ pacificnew etcetera factory backward systemv solar87 solar88 solar89
TZDATAFILES := $(TZDATA:%=data/%)
-ifeq ($(USE_PGTZ), yes)
all: SUBSYS.o submake-libpgport zic
SUBSYS.o: $(OBJS)
./zic -d $(DESTDIR)$(datadir)/timezone $(TZDATAFILES)
clean distclean maintainer-clean:
- rm -f SUBSYS.o $(OBJS) $(ZICOBJS)
-endif
-
+ rm -f SUBSYS.o zic $(OBJS) $(ZICOBJS)
ftp://elsie.nci.nih.gov/pub/tz*.tar.gz
-The interface is used when USE_PGTZ is defined at the top level. This
-will cause the following functions to be redefined:
- localtime pg_localtime
- gmtime pg_gmtime
- asctime pg_asctime
- ctime pg_ctime
- difftime pg_difftime
- mktime pg_mktime
- tzset pg_tzset
-
-and the TIMEZONE_GLOBAL define in c.h is redefined to pg_timezone.
-
+++ /dev/null
-#include "pgtz.h"
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
-*/
-
-#ifndef lint
-#ifndef NOID
-static char elsieid[] = "@(#)asctime.c 7.9";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*LINTLIBRARY*/
-
-#include "private.h"
-#include "tzfile.h"
-
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12.
-*/
-
-char *
-asctime_r(timeptr, buf)
-register const struct tm * timeptr;
-char * buf;
-{
- static const char wday_name[][3] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
- static const char mon_name[][3] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
- register const char * wn;
- register const char * mn;
-
- if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
- wn = "???";
- else wn = wday_name[timeptr->tm_wday];
- if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
- mn = "???";
- else mn = mon_name[timeptr->tm_mon];
- /*
- ** The X3J11-suggested format is
- ** "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n"
- ** Since the .2 in 02.2d is ignored, we drop it.
- */
- (void) sprintf(buf, "%.3s %.3s%3d %02d:%02d:%02d %d\n",
- wn, mn,
- timeptr->tm_mday, timeptr->tm_hour,
- timeptr->tm_min, timeptr->tm_sec,
- TM_YEAR_BASE + timeptr->tm_year);
- return buf;
-}
-
-/*
-** A la X3J11, with core dump avoidance.
-*/
-
-char *
-asctime(timeptr)
-register const struct tm * timeptr;
-{
- /*
- ** Big enough for something such as
- ** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
- ** (two three-character abbreviations, five strings denoting integers,
- ** three explicit spaces, two explicit colons, a newline,
- ** and a trailing ASCII nul).
- */
- static char result[3 * 2 + 5 * INT_STRLEN_MAXIMUM(int) +
- 3 + 2 + 1 + 1];
-
- return asctime_r(timeptr, result);
-}
+++ /dev/null
-#include "pgtz.h"
-/*
-** This file is in the public domain, so clarified as of
-** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
-*/
-
-#ifndef lint
-#ifndef NOID
-static char elsieid[] = "@(#)difftime.c 7.9";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*LINTLIBRARY*/
-
-#include "private.h"
-
-/*
-** Algorithm courtesy Paul Eggert (eggert@twinsun.com).
-*/
-
-#ifdef HAVE_LONG_DOUBLE
-#define long_double long double
-#endif /* defined HAVE_LONG_DOUBLE */
-#ifndef HAVE_LONG_DOUBLE
-#define long_double double
-#endif /* !defined HAVE_LONG_DOUBLE */
-
-double
-difftime(time1, time0)
-const time_t time1;
-const time_t time0;
-{
- time_t delta;
- time_t hibit;
-
- {
- time_t tt;
- double d;
- long_double ld;
-
- if (sizeof tt < sizeof d)
- return (double) time1 - (double) time0;
- if (sizeof tt < sizeof ld)
- return (long_double) time1 - (long_double) time0;
- }
- if (time1 < time0)
- return -difftime(time0, time1);
- /*
- ** As much as possible, avoid loss of precision
- ** by computing the difference before converting to double.
- */
- delta = time1 - time0;
- if (delta >= 0)
- return delta;
- /*
- ** Repair delta overflow.
- */
- hibit = (~ (time_t) 0) << (TYPE_BIT(time_t) - 1);
- /*
- ** The following expression rounds twice, which means
- ** the result may not be the closest to the true answer.
- ** For example, suppose time_t is 64-bit signed int,
- ** long_double is IEEE 754 double with default rounding,
- ** time1 = 9223372036854775807 and time0 = -1536.
- ** Then the true difference is 9223372036854777343,
- ** which rounds to 9223372036854777856
- ** with a total error of 513.
- ** But delta overflows to -9223372036854774273,
- ** which rounds to -9223372036854774784, and correcting
- ** this by subtracting 2 * (long_double) hibit
- ** (i.e. by adding 2**64 = 18446744073709551616)
- ** yields 9223372036854776832, which
- ** rounds to 9223372036854775808
- ** with a total error of 1535 instead.
- ** This problem occurs only with very large differences.
- ** It's too painful to fix this portably.
- ** We are not alone in this problem;
- ** some C compilers round twice when converting
- ** large unsigned types to small floating types,
- ** so if time_t is unsigned the "return delta" above
- ** has the same double-rounding problem with those compilers.
- */
- return delta - 2 * (long_double) hibit;
-}
-#ifndef lint
-#ifndef NOID
-static char elsieid[] = "@(#)ialloc.c 8.29";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*LINTLIBRARY*/
+#include "postgres.h"
#include "private.h"
+
#define nonzero(n) (((n) == 0) ? 1 : (n))
-char *
-imalloc(n)
-const int n;
+char *imalloc(const int n)
{
return malloc((size_t) nonzero(n));
}
-char *
-icalloc(nelem, elsize)
-int nelem;
-int elsize;
+char *icalloc(int nelem, int elsize)
{
if (nelem == 0 || elsize == 0)
nelem = elsize = 1;
return calloc((size_t) nelem, (size_t) elsize);
}
-void *
-irealloc(pointer, size)
-void * const pointer;
-const int size;
+void *irealloc(void *pointer, const int size)
{
if (pointer == NULL)
return imalloc(size);
return realloc((void *) pointer, (size_t) nonzero(size));
}
-char *
-icatalloc(old, new)
-char * const old;
-const char * const new;
+char *icatalloc(char *old, const char *new)
{
register char * result;
register int oldsize, newsize;
return result;
}
-char *
-icpyalloc(string)
-const char * const string;
+char *icpyalloc(const char *string)
{
return icatalloc((char *) NULL, string);
}
-void
-ifree(p)
-char * const p;
+void ifree(char *p)
{
if (p != NULL)
(void) free(p);
}
-void
-icfree(p)
-char * const p;
+void icfree(char *p)
{
if (p != NULL)
(void) free(p);
-#include "pgtz.h"
-#undef open
-#define timezone pg_timezone
-#define USG_COMPAT
-extern time_t pg_timezone;
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
*/
-#ifndef lint
-#ifndef NOID
-static char elsieid[] = "@(#)localtime.c 7.78";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
/*
** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu).
** POSIX-style TZ environment variable handling from Guy Harris
** (guy@auspex.com).
*/
-/*LINTLIBRARY*/
+#include "postgres.h"
+#include <fcntl.h>
+
+#include "pgtz.h"
#include "private.h"
#include "tzfile.h"
-#include "fcntl.h"
-/*
-** SunOS 4.1.1 headers lack O_BINARY.
-*/
-
-#ifdef O_BINARY
-#define OPEN_MODE (O_RDONLY | O_BINARY)
-#endif /* defined O_BINARY */
-#ifndef O_BINARY
-#define OPEN_MODE O_RDONLY
-#endif /* !defined O_BINARY */
#ifndef WILDABBR
/*
** implementation dependent; for historical reasons, US rules are a
** common default.
*/
-#ifndef TZDEFRULESTRING
#define TZDEFRULESTRING ",M4.1.0,M10.5.0"
-#endif /* !defined TZDEFDST */
struct ttinfo { /* time type information */
long tt_gmtoff; /* UTC offset in seconds */
#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
-#ifdef TZNAME_MAX
-#define MY_TZNAME_MAX TZNAME_MAX
-#endif /* defined TZNAME_MAX */
-#ifndef TZNAME_MAX
-#define MY_TZNAME_MAX 255
-#endif /* !defined TZNAME_MAX */
-
struct state {
int leapcnt;
int timecnt;
unsigned char types[TZ_MAX_TIMES];
struct ttinfo ttis[TZ_MAX_TYPES];
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
- (2 * (MY_TZNAME_MAX + 1)))];
+ (2 * (TZ_STRLEN_MAX + 1)))];
struct lsinfo lsis[TZ_MAX_LEAPS];
};
** Prototypes for static functions.
*/
-static long detzcode P((const char * codep));
-static const char * getzname P((const char * strp));
-static const char * getnum P((const char * strp, int * nump, int min,
- int max));
-static const char * getsecs P((const char * strp, long * secsp));
-static const char * getoffset P((const char * strp, long * offsetp));
-static const char * getrule P((const char * strp, struct rule * rulep));
-static void gmtload P((struct state * sp));
-static void gmtsub P((const time_t * timep, long offset,
- struct tm * tmp));
-static void localsub P((const time_t * timep, long offset,
- struct tm * tmp));
-static int increment_overflow P((int * number, int delta));
-static int normalize_overflow P((int * tensptr, int * unitsptr,
- int base));
-static void settzname P((void));
-static time_t time1 P((struct tm * tmp,
- void(*funcp) P((const time_t *,
- long, struct tm *)),
- long offset));
-static time_t time2 P((struct tm *tmp,
- void(*funcp) P((const time_t *,
- long, struct tm*)),
- long offset, int * okayp));
-static time_t time2sub P((struct tm *tmp,
- void(*funcp) P((const time_t *,
- long, struct tm*)),
- long offset, int * okayp, int do_norm_secs));
-static void timesub P((const time_t * timep, long offset,
- const struct state * sp, struct tm * tmp));
-static int tmcomp P((const struct tm * atmp,
- const struct tm * btmp));
-static time_t transtime P((time_t janfirst, int year,
- const struct rule * rulep, long offset));
-static int tzload P((const char * name, struct state * sp));
-static int tzparse P((const char * name, struct state * sp,
- int lastditch));
-
-#ifdef ALL_STATE
-static struct state * lclptr;
-static struct state * gmtptr;
-#endif /* defined ALL_STATE */
-
-#ifndef ALL_STATE
+static long detzcode(const char *codep);
+static const char *getzname(const char *strp);
+static const char *getnum(const char *strp, int *nump, int min, int max);
+static const char *getsecs(const char *strp, long *secsp);
+static const char *getoffset(const char *strp, long *offsetp);
+static const char *getrule(const char *strp, struct rule *rulep);
+static void gmtload(struct state *sp);
+static void gmtsub(const time_t *timep, long offset, struct pg_tm *tmp);
+static void localsub(const time_t *timep, long offset, struct pg_tm *tmp);
+static int increment_overflow(int *number, int delta);
+static int normalize_overflow(int *tensptr, int *unitsptr, int base);
+static time_t time1(struct pg_tm *tmp, void(*funcp)(const time_t *, long, struct pg_tm *), long offset);
+static time_t time2(struct pg_tm *tmp, void(*funcp)(const time_t *, long, struct pg_tm *), long offset, int *okayp);
+static time_t time2sub(struct pg_tm *tmp, void(*funcp)(const time_t *, long, struct pg_tm *), long offset, int *okayp, int do_norm_secs);
+static void timesub(const time_t *timep, long offset, const struct state *sp, struct pg_tm *tmp);
+static int tmcomp(const struct pg_tm *atmp, const struct pg_tm *btmp);
+static time_t transtime(time_t janfirst, int year, const struct rule *rulep, long offset);
+static int tzload(const char *name, struct state *sp);
+static int tzparse(const char *name, struct state *sp, int lastditch);
+
static struct state lclmem;
static struct state gmtmem;
#define lclptr (&lclmem)
#define gmtptr (&gmtmem)
-#endif /* State Farm */
-
-#ifndef TZ_STRLEN_MAX
-#define TZ_STRLEN_MAX 255
-#endif /* !defined TZ_STRLEN_MAX */
static char lcl_TZname[TZ_STRLEN_MAX + 1];
-static int lcl_is_set;
-static int gmt_is_set;
-
-char * tzname[2] = {
- wildabbr,
- wildabbr
-};
+static int lcl_is_set=0;
+static int gmt_is_set=0;
/*
** Section 4.12.3 of X3.159-1989 requires that
** Thanks to Paul Eggert (eggert@twinsun.com) for noting this.
*/
-static struct tm tm;
+static struct pg_tm tm;
-#ifdef USG_COMPAT
-time_t timezone = 0;
-int daylight = 0;
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
-time_t altzone = 0;
-#endif /* defined ALTZONE */
-
-static long
-detzcode(codep)
-const char * const codep;
+static long detzcode(const char *codep)
{
register long result;
register int i;
return result;
}
-static void
-settzname P((void))
-{
- register struct state * const sp = lclptr;
- register int i;
-
- tzname[0] = wildabbr;
- tzname[1] = wildabbr;
-#ifdef USG_COMPAT
- daylight = 0;
- timezone = 0;
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
- altzone = 0;
-#endif /* defined ALTZONE */
-#ifdef ALL_STATE
- if (sp == NULL) {
- tzname[0] = tzname[1] = gmt;
- return;
- }
-#endif /* defined ALL_STATE */
- for (i = 0; i < sp->typecnt; ++i) {
- register const struct ttinfo * const ttisp = &sp->ttis[i];
-
- tzname[ttisp->tt_isdst] =
- &sp->chars[ttisp->tt_abbrind];
-#ifdef USG_COMPAT
- if (ttisp->tt_isdst)
- daylight = 1;
- if (i == 0 || !ttisp->tt_isdst)
- timezone = -(ttisp->tt_gmtoff);
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
- if (i == 0 || ttisp->tt_isdst)
- altzone = -(ttisp->tt_gmtoff);
-#endif /* defined ALTZONE */
- }
- /*
- ** And to get the latest zone names into tzname. . .
- */
- for (i = 0; i < sp->timecnt; ++i) {
- register const struct ttinfo * const ttisp =
- &sp->ttis[
- sp->types[i]];
-
- tzname[ttisp->tt_isdst] =
- &sp->chars[ttisp->tt_abbrind];
- }
-}
-
-static int
-tzload(name, sp)
-register const char * name;
-register struct state * const sp;
+static int tzload(register const char *name, register struct state *sp)
{
register const char * p;
register int i;
return -1;
{
register int doaccess;
- /*
- ** Section 4.9.1 of the C standard says that
- ** "FILENAME_MAX expands to an integral constant expression
- ** that is the size needed for an array of char large enough
- ** to hold the longest file name string that the implementation
- ** guarantees can be opened."
- */
- char fullname[FILENAME_MAX + 1];
+ char fullname[MAXPGPATH];
if (name[0] == ':')
++name;
doaccess = name[0] == '/';
if (!doaccess) {
- if ((p = TZDIR) == NULL)
+ p = pg_TZDIR();
+ if (p == NULL)
return -1;
if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
return -1;
}
if (doaccess && access(name, R_OK) != 0)
return -1;
- if ((fid = open(name, OPEN_MODE)) == -1)
+ if ((fid = open(name, O_RDONLY | PG_BINARY)) == -1)
return -1;
}
{
** character.
*/
-static const char *
-getzname(strp)
-register const char * strp;
+static const char *getzname(register const char *strp)
{
register char c;
** Otherwise, return a pointer to the first character not part of the number.
*/
-static const char *
-getnum(strp, nump, min, max)
-register const char * strp;
-int * const nump;
-const int min;
-const int max;
+static const char *getnum(register const char *strp, int *nump, const int min, const int max)
{
register char c;
register int num;
** of seconds.
*/
-static const char *
-getsecs(strp, secsp)
-register const char * strp;
-long * const secsp;
+static const char *getsecs(register const char *strp, long *secsp)
{
int num;
** Otherwise, return a pointer to the first character not part of the time.
*/
-static const char *
-getoffset(strp, offsetp)
-register const char * strp;
-long * const offsetp;
+static const char *getoffset(register const char *strp, long *offsetp)
{
register int neg = 0;
** Otherwise, return a pointer to the first character not part of the rule.
*/
-static const char *
-getrule(strp, rulep)
-const char * strp;
-register struct rule * const rulep;
+static const char *getrule(const char *strp, register struct rule *rulep)
{
if (*strp == 'J') {
/*
** calculate the Epoch-relative time that rule takes effect.
*/
-static time_t
-transtime(janfirst, year, rulep, offset)
-const time_t janfirst;
-const int year;
-register const struct rule * const rulep;
-const long offset;
+static time_t transtime(const time_t janfirst, const int year, register const struct rule *rulep, const long offset)
{
register int leapyear;
- register time_t value;
+ register time_t value = 0;
register int i;
int d, m1, yy0, yy1, yy2, dow;
- INITIALIZE(value);
leapyear = isleap(year);
switch (rulep->r_type) {
** appropriate.
*/
-static int
-tzparse(name, sp, lastditch)
-const char * name;
-register struct state * const sp;
-const int lastditch;
+static int tzparse(const char *name, register struct state *sp, const int lastditch)
{
const char * stdname;
- const char * dstname;
+ const char * dstname = NULL;
size_t stdlen;
size_t dstlen;
long stdoffset;
register char * cp;
register int load_result;
- INITIALIZE(dstname);
stdname = name;
if (lastditch) {
stdlen = strlen(name); /* length of standard zone name */
return 0;
}
-static void
-gmtload(sp)
-struct state * const sp;
+static void gmtload(struct state *sp)
{
if (tzload(gmt, sp) != 0)
(void) tzparse(gmt, sp, TRUE);
}
-#ifndef STD_INSPIRED
-/*
-** A non-static declaration of tzsetwall in a system header file
-** may cause a warning about this upcoming static declaration...
-*/
-static
-#endif /* !defined STD_INSPIRED */
-void
-tzsetwall P((void))
-{
- if (lcl_is_set < 0)
- return;
- lcl_is_set = -1;
-
-#ifdef ALL_STATE
- if (lclptr == NULL) {
- lclptr = (struct state *) malloc(sizeof *lclptr);
- if (lclptr == NULL) {
- settzname(); /* all we can do */
- return;
- }
- }
-#endif /* defined ALL_STATE */
- if (tzload((char *) NULL, lclptr) != 0)
- gmtload(lclptr);
- settzname();
-}
-void
-tzset P((void))
+bool pg_tzset(const char *name)
{
- register const char * name;
+ if (lcl_is_set && strcmp(lcl_TZname, name) == 0)
+ return true; /* no change */
- name = getenv("TZ");
- if (name == NULL) {
- tzsetwall();
- return;
- }
+ if (strlen(name) >= sizeof(lcl_TZname))
+ return false; /* not gonna fit */
- if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0)
- return;
- lcl_is_set = strlen(name) < sizeof lcl_TZname;
- if (lcl_is_set)
- (void) strcpy(lcl_TZname, name);
-
-#ifdef ALL_STATE
- if (lclptr == NULL) {
- lclptr = (struct state *) malloc(sizeof *lclptr);
- if (lclptr == NULL) {
- settzname(); /* all we can do */
- return;
+ if (tzload(name, lclptr) != 0) {
+ if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
+ {
+ /* Unknown timezone. Fail our call instead of loading GMT! */
+ return false;
}
}
-#endif /* defined ALL_STATE */
- if (*name == '\0') {
- /*
- ** User wants it fast rather than right.
- */
- lclptr->leapcnt = 0; /* so, we're off a little */
- lclptr->timecnt = 0;
- lclptr->typecnt = 0;
- lclptr->ttis[0].tt_isdst = 0;
- lclptr->ttis[0].tt_gmtoff = 0;
- lclptr->ttis[0].tt_abbrind = 0;
- (void) strcpy(lclptr->chars, gmt);
- } else if (tzload(name, lclptr) != 0)
- if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
- (void) gmtload(lclptr);
- settzname();
+
+ strcpy(lcl_TZname, name);
+ lcl_is_set = true;
+
+ return true;
}
/*
** The unused offset argument is for the benefit of mktime variants.
*/
-/*ARGSUSED*/
-static void
-localsub(timep, offset, tmp)
-const time_t * const timep;
-const long offset;
-struct tm * const tmp;
+static void localsub(const time_t *timep, const long offset, struct pg_tm *tmp)
{
register struct state * sp;
register const struct ttinfo * ttisp;
const time_t t = *timep;
sp = lclptr;
-#ifdef ALL_STATE
- if (sp == NULL) {
- gmtsub(timep, offset, tmp);
- return;
- }
-#endif /* defined ALL_STATE */
if (sp->timecnt == 0 || t < sp->ats[0]) {
i = 0;
while (sp->ttis[i].tt_isdst)
}
} else {
for (i = 1; i < sp->timecnt; ++i)
- if (t < sp->ats[i])
+ if (t < sp->ats[i])
break;
i = sp->types[i - 1];
}
*/
timesub(&t, ttisp->tt_gmtoff, sp, tmp);
tmp->tm_isdst = ttisp->tt_isdst;
- tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
-#ifdef TM_ZONE
- tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
-#endif /* defined TM_ZONE */
+ tmp->tm_zone = &sp->chars[ttisp->tt_abbrind];
}
-struct tm *
-localtime(timep)
-const time_t * const timep;
+struct pg_tm *pg_localtime(const time_t *timep)
{
- tzset();
localsub(timep, 0L, &tm);
return &tm;
}
-/*
-** Re-entrant version of localtime.
-*/
-
-struct tm *
-localtime_r(timep, tm)
-const time_t * const timep;
-struct tm * tm;
-{
- localsub(timep, 0L, tm);
- return tm;
-}
/*
** gmtsub is to gmtime as localsub is to localtime.
*/
-static void
-gmtsub(timep, offset, tmp)
-const time_t * const timep;
-const long offset;
-struct tm * const tmp;
+static void gmtsub(const time_t *timep, const long offset, struct pg_tm *tmp)
{
if (!gmt_is_set) {
gmt_is_set = TRUE;
-#ifdef ALL_STATE
- gmtptr = (struct state *) malloc(sizeof *gmtptr);
- if (gmtptr != NULL)
-#endif /* defined ALL_STATE */
- gmtload(gmtptr);
+ gmtload(gmtptr);
}
timesub(timep, offset, gmtptr, tmp);
-#ifdef TM_ZONE
/*
** Could get fancy here and deliver something such as
** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
** but this is no time for a treasure hunt.
*/
if (offset != 0)
- tmp->TM_ZONE = wildabbr;
+ tmp->tm_zone = wildabbr;
else {
-#ifdef ALL_STATE
- if (gmtptr == NULL)
- tmp->TM_ZONE = gmt;
- else tmp->TM_ZONE = gmtptr->chars;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
- tmp->TM_ZONE = gmtptr->chars;
-#endif /* State Farm */
+ tmp->tm_zone = gmtptr->chars;
}
-#endif /* defined TM_ZONE */
}
-struct tm *
-gmtime(timep)
-const time_t * const timep;
+struct pg_tm *pg_gmtime(const time_t *timep)
{
gmtsub(timep, 0L, &tm);
return &tm;
}
-/*
-* Re-entrant version of gmtime.
-*/
-
-struct tm *
-gmtime_r(timep, tm)
-const time_t * const timep;
-struct tm * tm;
-{
- gmtsub(timep, 0L, tm);
- return tm;
-}
-#ifdef STD_INSPIRED
-
-struct tm *
-offtime(timep, offset)
-const time_t * const timep;
-const long offset;
-{
- gmtsub(timep, offset, &tm);
- return &tm;
-}
-
-#endif /* defined STD_INSPIRED */
-
-static void
-timesub(timep, offset, sp, tmp)
-const time_t * const timep;
-const long offset;
-register const struct state * const sp;
-register struct tm * const tmp;
+static void timesub(const time_t *timep, const long offset, register const struct state *sp, register struct pg_tm *tmp)
{
register const struct lsinfo * lp;
register long days;
corr = 0;
hit = 0;
-#ifdef ALL_STATE
- i = (sp == NULL) ? 0 : sp->leapcnt;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
i = sp->leapcnt;
-#endif /* State Farm */
while (--i >= 0) {
lp = &sp->lsis[i];
if (*timep >= lp->ls_trans) {
days = days - (long) ip[tmp->tm_mon];
tmp->tm_mday = (int) (days + 1);
tmp->tm_isdst = 0;
-#ifdef TM_GMTOFF
- tmp->TM_GMTOFF = offset;
-#endif /* defined TM_GMTOFF */
-}
-
-char *
-ctime(timep)
-const time_t * const timep;
-{
-/*
-** Section 4.12.3.2 of X3.159-1989 requires that
-** The ctime function converts the calendar time pointed to by timer
-** to local time in the form of a string. It is equivalent to
-** asctime(localtime(timer))
-*/
- return asctime(localtime(timep));
-}
-
-char *
-ctime_r(timep, buf)
-const time_t * const timep;
-char * buf;
-{
- struct tm tm;
-
- return asctime_r(localtime_r(timep, &tm), buf);
+ tmp->tm_gmtoff = offset;
}
/*
** would still be very reasonable).
*/
-#ifndef WRONG
#define WRONG (-1)
-#endif /* !defined WRONG */
/*
** Simplified normalize logic courtesy Paul Eggert (eggert@twinsun.com).
*/
-static int
-increment_overflow(number, delta)
-int * number;
-int delta;
+static int increment_overflow(int *number, int delta)
{
int number0;
return (*number < number0) != (delta < 0);
}
-static int
-normalize_overflow(tensptr, unitsptr, base)
-int * const tensptr;
-int * const unitsptr;
-const int base;
+static int normalize_overflow(int *tensptr, int *unitsptr, const int base)
{
register int tensdelta;
return increment_overflow(tensptr, tensdelta);
}
-static int
-tmcomp(atmp, btmp)
-register const struct tm * const atmp;
-register const struct tm * const btmp;
+static int tmcomp(register const struct pg_tm *atmp, register const struct pg_tm *btmp)
{
register int result;
return result;
}
-static time_t
-time2sub(tmp, funcp, offset, okayp, do_norm_secs)
-struct tm * const tmp;
-void (* const funcp) P((const time_t*, long, struct tm*));
-const long offset;
-int * const okayp;
-const int do_norm_secs;
+static time_t time2sub(struct pg_tm *tmp, void(*funcp)(const time_t *, long, struct pg_tm *), const long offset, int *okayp, const int do_norm_secs)
{
register const struct state * sp;
register int dir;
register int saved_seconds;
time_t newt;
time_t t;
- struct tm yourtm, mytm;
+ struct pg_tm yourtm, mytm;
*okayp = FALSE;
yourtm = *tmp;
sp = (const struct state *)
(((void *) funcp == (void *) localsub) ?
lclptr : gmtptr);
-#ifdef ALL_STATE
- if (sp == NULL)
- return WRONG;
-#endif /* defined ALL_STATE */
for (i = sp->typecnt - 1; i >= 0; --i) {
if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
continue;
return t;
}
-static time_t
-time2(tmp, funcp, offset, okayp)
-struct tm * const tmp;
-void (* const funcp) P((const time_t*, long, struct tm*));
-const long offset;
-int * const okayp;
+static time_t time2(struct pg_tm *tmp, void(*funcp)(const time_t*, long, struct pg_tm*), const long offset, int *okayp)
{
time_t t;
return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
}
-static time_t
-time1(tmp, funcp, offset)
-struct tm * const tmp;
-void (* const funcp) P((const time_t *, long, struct tm *));
-const long offset;
+static time_t time1(struct pg_tm *tmp, void (*funcp)(const time_t *, long, struct pg_tm *), const long offset)
{
register time_t t;
register const struct state * sp;
if (tmp->tm_isdst > 1)
tmp->tm_isdst = 1;
t = time2(tmp, funcp, offset, &okay);
-#ifdef PCTS
- /*
- ** PCTS code courtesy Grant Sullivan (grant@osf.org).
- */
- if (okay)
- return t;
- if (tmp->tm_isdst < 0)
- tmp->tm_isdst = 0; /* reset to std and try again */
-#endif /* defined PCTS */
-#ifndef PCTS
if (okay || tmp->tm_isdst < 0)
return t;
-#endif /* !defined PCTS */
/*
** We're supposed to assume that somebody took a time of one type
- ** and did some math on it that yielded a "struct tm" that's bad.
+ ** and did some math on it that yielded a "struct pg_tm" that's bad.
** We try to divine the type they started from and adjust to the
** type they need.
*/
*/
sp = (const struct state *) (((void *) funcp == (void *) localsub) ?
lclptr : gmtptr);
-#ifdef ALL_STATE
- if (sp == NULL)
- return WRONG;
-#endif /* defined ALL_STATE */
for (i = 0; i < sp->typecnt; ++i)
seen[i] = FALSE;
nseen = 0;
return WRONG;
}
-time_t
-mktime(tmp)
-struct tm * const tmp;
+time_t pg_mktime(struct pg_tm *tmp)
{
- tzset();
return time1(tmp, localsub, 0L);
}
-#ifdef STD_INSPIRED
-
-time_t
-timelocal(tmp)
-struct tm * const tmp;
-{
- tmp->tm_isdst = -1; /* in case it wasn't initialized */
- return mktime(tmp);
-}
-
-time_t
-timegm(tmp)
-struct tm * const tmp;
-{
- tmp->tm_isdst = 0;
- return time1(tmp, gmtsub, 0L);
-}
-
-time_t
-timeoff(tmp, offset)
-struct tm * const tmp;
-const long offset;
-{
- tmp->tm_isdst = 0;
- return time1(tmp, gmtsub, offset);
-}
-
-#endif /* defined STD_INSPIRED */
-
-#ifdef CMUCS
-
/*
-** The following is supplied for compatibility with
-** previous versions of the CMUCS runtime library.
-*/
-
-long
-gtime(tmp)
-struct tm * const tmp;
-{
- const time_t t = mktime(tmp);
-
- if (t == WRONG)
- return -1;
- return t;
-}
-
-#endif /* defined CMUCS */
-
-/*
-** XXX--is the below the right way to conditionalize??
-*/
-
-#ifdef STD_INSPIRED
-
-/*
-** IEEE Std 1003.1-1988 (POSIX) legislates that 536457599
-** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
-** is not the case if we are accounting for leap seconds.
-** So, we provide the following conversion routines for use
-** when exchanging timestamps with POSIX conforming systems.
-*/
-
-static long
-leapcorr(timep)
-time_t * timep;
-{
- register struct state * sp;
- register struct lsinfo * lp;
- register int i;
-
- sp = lclptr;
- i = sp->leapcnt;
- while (--i >= 0) {
- lp = &sp->lsis[i];
- if (*timep >= lp->ls_trans)
- return lp->ls_corr;
- }
- return 0;
-}
-
-time_t
-time2posix(t)
-time_t t;
-{
- tzset();
- return t - leapcorr(&t);
-}
-
-time_t
-posix2time(t)
-time_t t;
-{
- time_t x;
- time_t y;
-
- tzset();
- /*
- ** For a positive leap second hit, the result
- ** is not unique. For a negative leap second
- ** hit, the corresponding time doesn't exist,
- ** so we return an adjacent second.
- */
- x = t + leapcorr(&t);
- y = x - leapcorr(&x);
- if (y < t) {
- do {
- x++;
- y = x - leapcorr(&x);
- } while (y < t);
- if (t != y)
- return x - 1;
- } else if (y > t) {
- do {
- --x;
- y = x - leapcorr(&x);
- } while (y > t);
- if (t != y)
- return x + 1;
- }
- return x;
+ * Return the name of the current timezone
+ */
+const char *
+pg_get_current_timezone(void) {
+ if (lcl_is_set)
+ return lcl_TZname;
+ return NULL;
}
-
-#endif /* defined STD_INSPIRED */
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.9 2004/05/18 03:36:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.10 2004/05/21 05:08:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
+#define NO_REDEFINE_TIMEFUNCS
+#include "postgres.h"
+
+#include <ctype.h>
+
+#include "miscadmin.h"
+#include "pgtime.h"
#include "pgtz.h"
#include "tzfile.h"
+#include "utils/elog.h"
+#include "utils/guc.h"
static char tzdir[MAXPGPATH];
done_tzdir = 1;
return tzdir;
}
+
+/*
+ * Try to determine the system timezone (as opposed to the timezone
+ * set in our own library).
+ */
+#define T_YEAR (60*60*24*365)
+#define T_MONTH (60*60*24*30)
+
+struct tztry {
+ time_t std_t,dst_t;
+ char std_time[TZ_STRLEN_MAX+1],dst_time[TZ_STRLEN_MAX+1];
+ int std_ofs,dst_ofs;
+ struct tm std_tm, dst_tm;
+};
+
+
+static bool compare_tm(struct tm *s, struct pg_tm *p) {
+ if (s->tm_sec != p->tm_sec ||
+ s->tm_min != p->tm_min ||
+ s->tm_hour != p->tm_hour ||
+ s->tm_mday != p->tm_mday ||
+ s->tm_mon != p->tm_mon ||
+ s->tm_year != p->tm_year ||
+ s->tm_wday != p->tm_wday ||
+ s->tm_yday != p->tm_yday ||
+ s->tm_isdst != p->tm_isdst)
+ return false;
+ return true;
+}
+
+static bool try_timezone(char *tzname, struct tztry *tt, bool checkdst) {
+ struct pg_tm *pgtm;
+
+ if (!pg_tzset(tzname))
+ return false; /* If this timezone couldn't be picked at all */
+
+ /* Verify standard time */
+ pgtm = pg_localtime(&(tt->std_t));
+ if (!pgtm)
+ return false;
+ if (!compare_tm(&(tt->std_tm), pgtm))
+ return false;
+
+ if (!checkdst)
+ return true;
+
+ /* Now check daylight time */
+ pgtm = pg_localtime(&(tt->dst_t));
+ if (!pgtm)
+ return false;
+ if (!compare_tm(&(tt->dst_tm), pgtm))
+ return false;
+
+ return true;
+}
+
+static int get_timezone_offset(struct tm *tm) {
+#if defined(HAVE_STRUCT_TM_TM_ZONE)
+ return tm->tm_gmtoff;
+#elif defined(HAVE_INT_TIMEZONE)
+#ifdef HAVE_UNDERSCORE_TIMEZONE
+ return -_timezone;
+#else
+ return -timezone;
+#endif
+#else
+#error No way to determine TZ? Can this happen?
+#endif
+}
+
+
+#ifdef WIN32
+#define TZABBREV(tz) win32_get_timezone_abbrev(tz)
+
+static char *win32_get_timezone_abbrev(char *tz) {
+ static char w32tzabbr[TZ_STRLEN_MAX+1];
+ int l = 0;
+ char *c;
+
+ for (c = tz; *c; c++) {
+ if (isupper(*c))
+ w32tzabbr[l++] = *c;
+ }
+ w32tzabbr[l] = '\0';
+ return w32tzabbr;
+}
+
+#else
+#define TZABBREV(tz) tz
+#endif
+
+
+/*
+ * Try to identify a timezone name (in our terminology) that matches the
+ * observed behavior of the system timezone library. We cannot assume that
+ * the system TZ environment setting (if indeed there is one) matches our
+ * terminology, so ignore it and just look at what localtime() returns.
+ */
+static char *
+identify_system_timezone(void)
+{
+ static char __tzbuf[TZ_STRLEN_MAX+1];
+ bool std_found=false,
+ dst_found=false;
+ time_t tnow = time(NULL);
+ time_t t;
+ struct tztry tt;
+ char cbuf[TZ_STRLEN_MAX+1];
+
+ /* Initialize OS timezone library */
+ tzset();
+
+ memset(&tt, 0, sizeof(tt));
+
+ for (t = tnow; t < tnow+T_YEAR; t += T_MONTH) {
+ struct tm *tm = localtime(&t);
+
+ if (tm->tm_isdst == 0 && !std_found) {
+ /* Standard time */
+ memcpy(&tt.std_tm, tm, sizeof(struct tm));
+ memset(cbuf,0,sizeof(cbuf));
+ strftime(cbuf, sizeof(cbuf)-1, "%Z", tm); /* zone abbr */
+ strcpy(tt.std_time, TZABBREV(cbuf));
+ tt.std_ofs = get_timezone_offset(tm);
+ tt.std_t = t;
+ std_found = true;
+ }
+ else if (tm->tm_isdst == 1 && !dst_found) {
+ /* Daylight time */
+ memcpy(&tt.dst_tm, tm, sizeof(struct tm));
+ memset(cbuf,0,sizeof(cbuf));
+ strftime(cbuf, sizeof(cbuf)-1, "%Z", tm); /* zone abbr */
+ strcpy(tt.dst_time, TZABBREV(cbuf));
+ tt.dst_ofs = get_timezone_offset(tm);
+ tt.dst_t = t;
+ dst_found = true;
+ }
+ if (std_found && dst_found)
+ break; /* Got both standard and daylight */
+ }
+
+ if (!std_found)
+ {
+ /* Failed to determine TZ! */
+ ereport(LOG,
+ (errmsg("unable to determine system timezone, defaulting to \"%s\"", "GMT"),
+ errhint("You can specify the correct timezone in postgresql.conf.")));
+ return NULL; /* go to GMT */
+ }
+
+ if (dst_found) {
+ /* Try STD<ofs>DST */
+ sprintf(__tzbuf,"%s%d%s",tt.std_time,-tt.std_ofs/3600,tt.dst_time);
+ if (try_timezone(__tzbuf, &tt, dst_found))
+ return __tzbuf;
+ }
+ /* Try just the STD timezone */
+ strcpy(__tzbuf,tt.std_time);
+ if (try_timezone(__tzbuf, &tt, dst_found))
+ return __tzbuf;
+
+ /* Did not find the timezone. Fallback to try a GMT zone. */
+ sprintf(__tzbuf,"Etc/GMT%s%d",
+ (-tt.std_ofs<0)?"+":"",tt.std_ofs/3600);
+ ereport(LOG,
+ (errmsg("could not recognize system timezone, defaulting to \"%s\"",
+ __tzbuf),
+ errhint("You can specify the correct timezone in postgresql.conf.")));
+ return __tzbuf;
+}
+
+/*
+ * Check whether timezone is acceptable.
+ *
+ * What we are doing here is checking for leap-second-aware timekeeping.
+ * We need to reject such TZ settings because they'll wreak havoc with our
+ * date/time arithmetic.
+ *
+ * NB: this must NOT ereport(ERROR). The caller must get control back so that
+ * it can restore the old value of TZ if we don't like the new one.
+ */
+bool
+tz_acceptable(void)
+{
+ struct pg_tm tt;
+ time_t time2000;
+
+ /*
+ * To detect leap-second timekeeping, compute the time_t value for
+ * local midnight, 2000-01-01. Insist that this be a multiple of 60;
+ * any partial-minute offset has to be due to leap seconds.
+ */
+ MemSet(&tt, 0, sizeof(tt));
+ tt.tm_year = 100;
+ tt.tm_mon = 0;
+ tt.tm_mday = 1;
+ tt.tm_isdst = -1;
+ time2000 = pg_mktime(&tt);
+ if ((time2000 % 60) != 0)
+ return false;
+
+ return true;
+}
+
+/*
+ * Identify a suitable default timezone setting based on the environment,
+ * and make it active.
+ *
+ * We first look to the TZ environment variable. If not found or not
+ * recognized by our own code, we see if we can identify the timezone
+ * from the behavior of the system timezone library. When all else fails,
+ * fall back to GMT.
+ */
+const char *
+select_default_timezone(void)
+{
+ char *def_tz;
+
+ def_tz = getenv("TZ");
+ if (def_tz && pg_tzset(def_tz) && tz_acceptable())
+ return def_tz;
+
+ def_tz = identify_system_timezone();
+ if (def_tz && pg_tzset(def_tz) && tz_acceptable())
+ return def_tz;
+
+ if (pg_tzset("GMT") && tz_acceptable())
+ return "GMT";
+
+ ereport(FATAL,
+ (errmsg("could not select a suitable default timezone"),
+ errdetail("It appears that your GMT time zone uses leap seconds. PostgreSQL does not support leap seconds.")));
+ return NULL; /* keep compiler quiet */
+}
+
+/*
+ * Initialize timezone library
+ *
+ * This is called after initial loading of postgresql.conf. If no TimeZone
+ * setting was found therein, we try to derive one from the environment.
+ */
+void pg_timezone_initialize(void) {
+ /* Do we need to try to figure the timezone? */
+ if (strcmp(GetConfigOption("timezone"), "UNKNOWN") == 0) {
+ const char *def_tz;
+
+ /* Select setting */
+ def_tz = select_default_timezone();
+ /* Tell GUC about the value. Will redundantly call pg_tzset() */
+ SetConfigOption("timezone", def_tz, PGC_POSTMASTER, PGC_S_ENV_VAR);
+ }
+}
-#include "postgres.h"
-#include "miscadmin.h"
+/*-------------------------------------------------------------------------
+ *
+ * pgtz.h
+ * Timezone Library Integration Functions
+ *
+ * Note: this file contains only definitions that are private to the
+ * timezone library. Public definitions are in pgtime.h.
+ *
+ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.7 2004/05/21 05:08:06 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _PGTZ_H
+#define _PGTZ_H
-#ifndef HAVE_SYMLINK
-#define HAVE_SYMLINK 0
-#endif
+#define TZ_STRLEN_MAX 255
+extern char *pg_TZDIR(void);
-#define NOID
-#define TZDIR pg_TZDIR()
-
-char *pg_TZDIR(void);
+#endif /* _PGTZ_H */
#ifndef PRIVATE_H
-
#define PRIVATE_H
/*
** Thank you!
*/
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-static char privatehid[] = "@(#)private.h 7.53";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
-** Defaults for preprocessor symbols.
-** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
-*/
-
-#ifndef HAVE_ADJTIME
-#define HAVE_ADJTIME 1
-#endif /* !defined HAVE_ADJTIME */
-
-#ifndef HAVE_GETTEXT
-#define HAVE_GETTEXT 0
-#endif /* !defined HAVE_GETTEXT */
-
-#ifndef HAVE_INCOMPATIBLE_CTIME_R
-#define HAVE_INCOMPATIBLE_CTIME_R 0
-#endif /* !defined INCOMPATIBLE_CTIME_R */
-
-#ifndef HAVE_SETTIMEOFDAY
-#define HAVE_SETTIMEOFDAY 3
-#endif /* !defined HAVE_SETTIMEOFDAY */
-
-#ifndef HAVE_STRERROR
-#define HAVE_STRERROR 1
-#endif /* !defined HAVE_STRERROR */
-
-#ifndef HAVE_SYMLINK
-#define HAVE_SYMLINK 1
-#endif /* !defined HAVE_SYMLINK */
-
-#ifndef HAVE_SYS_STAT_H
-#define HAVE_SYS_STAT_H 1
-#endif /* !defined HAVE_SYS_STAT_H */
-
-#ifndef HAVE_SYS_WAIT_H
-#define HAVE_SYS_WAIT_H 1
-#endif /* !defined HAVE_SYS_WAIT_H */
-
-#ifndef HAVE_UNISTD_H
-#define HAVE_UNISTD_H 1
-#endif /* !defined HAVE_UNISTD_H */
-
-#ifndef HAVE_UTMPX_H
-#define HAVE_UTMPX_H 0
-#endif /* !defined HAVE_UTMPX_H */
-
-#ifndef LOCALE_HOME
-#define LOCALE_HOME "/usr/lib/locale"
-#endif /* !defined LOCALE_HOME */
-
-#if HAVE_INCOMPATIBLE_CTIME_R
-#define asctime_r _incompatible_asctime_r
-#define ctime_r _incompatible_ctime_r
-#endif /* HAVE_INCOMPATIBLE_CTIME_R */
-
-/*
-** Nested includes
-*/
-
-#include "sys/types.h" /* for time_t */
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "limits.h" /* for CHAR_BIT */
-
-#define save_timezone pg_timezone
-#undef timezone
-#include "time.h"
-#define timezone save_timezone
+#include <limits.h> /* for CHAR_BIT */
+#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
+#include <unistd.h> /* for F_OK and R_OK */
-#include "stdlib.h"
+#include "pgtime.h"
-#if HAVE_GETTEXT - 0
-#include "libintl.h"
-#endif /* HAVE_GETTEXT - 0 */
-
-#if HAVE_SYS_WAIT_H - 0
-#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
-#endif /* HAVE_SYS_WAIT_H - 0 */
#ifndef WIFEXITED
#define WIFEXITED(status) (((status) & 0xff) == 0)
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
#endif /* !defined WEXITSTATUS */
-#if HAVE_UNISTD_H - 0
-#include "unistd.h" /* for F_OK and R_OK */
-#endif /* HAVE_UNISTD_H - 0 */
-
-#if !(HAVE_UNISTD_H - 0)
-#ifndef F_OK
-#define F_OK 0
-#endif /* !defined F_OK */
-#ifndef R_OK
-#define R_OK 4
-#endif /* !defined R_OK */
-#endif /* !(HAVE_UNISTD_H - 0) */
-
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
-/*
-** Workarounds for compilers/systems.
-*/
-
-/*
-** SunOS 4.1.1 cc lacks prototypes.
-*/
-
-#ifndef P
-#ifdef __STDC__
-#define P(x) x
-#endif /* defined __STDC__ */
-#ifndef __STDC__
-#define P(x) ()
-#endif /* !defined __STDC__ */
-#endif /* !defined P */
-
/*
** SunOS 4.1.1 headers lack EXIT_SUCCESS.
*/
#define EXIT_FAILURE 1
#endif /* !defined EXIT_FAILURE */
-/*
-** SunOS 4.1.1 headers lack FILENAME_MAX.
-*/
-
-#ifndef FILENAME_MAX
-
-#ifndef MAXPATHLEN
-#ifdef unix
-#include "sys/param.h"
-#endif /* defined unix */
-#endif /* !defined MAXPATHLEN */
-
-#ifdef MAXPATHLEN
-#define FILENAME_MAX MAXPATHLEN
-#endif /* defined MAXPATHLEN */
-#ifndef MAXPATHLEN
-#define FILENAME_MAX 1024 /* Pure guesswork */
-#endif /* !defined MAXPATHLEN */
-
-#endif /* !defined FILENAME_MAX */
-
/*
** SunOS 4.1.1 libraries lack remove.
*/
#ifndef remove
-extern int unlink P((const char * filename));
+extern int unlink (const char * filename);
#define remove unlink
#endif /* !defined remove */
/*
-** Some ancient errno.h implementations don't declare errno.
-** But some newer errno.h implementations define it as a macro.
-** Fix the former without affecting the latter.
-*/
-#ifndef errno
-extern int errno;
-#endif /* !defined errno */
-
-/*
-** Private function declarations.
-*/
-char * icalloc P((int nelem, int elsize));
-char * icatalloc P((char * old, const char * new));
-char * icpyalloc P((const char * string));
-char * imalloc P((int n));
-void * irealloc P((void * pointer, int size));
-void icfree P((char * pointer));
-void ifree P((char * pointer));
-char * scheck P((const char *string, const char *format));
+ * Private function declarations.
+ */
+extern char *icalloc (int nelem, int elsize);
+extern char *icatalloc (char *old, const char *new);
+extern char *icpyalloc (const char *string);
+extern char *imalloc (int n);
+extern void *irealloc (void *pointer, int size);
+extern void icfree (char *pointer);
+extern void ifree (char *pointer);
+extern char *scheck (const char *string, const char *format);
/*
-** Finally, some convenience items.
-*/
+ * Finally, some convenience items.
+ */
#ifndef TRUE
#define TRUE 1
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
#endif /* !defined INT_STRLEN_MAXIMUM */
-/*
-** INITIALIZE(x)
-*/
-
-#ifndef GNUC_or_lint
-#ifdef lint
-#define GNUC_or_lint
-#endif /* defined lint */
-#ifndef lint
-#ifdef __GNUC__
-#define GNUC_or_lint
-#endif /* defined __GNUC__ */
-#endif /* !defined lint */
-#endif /* !defined GNUC_or_lint */
-
-#ifndef INITIALIZE
-#ifdef GNUC_or_lint
-#define INITIALIZE(x) ((x) = 0)
-#endif /* defined GNUC_or_lint */
-#ifndef GNUC_or_lint
-#define INITIALIZE(x)
-#endif /* !defined GNUC_or_lint */
-#endif /* !defined INITIALIZE */
-
-/*
-** For the benefit of GNU folk...
-** `_(MSGID)' uses the current locale's message library string for MSGID.
-** The default is to use gettext if available, and use MSGID otherwise.
-*/
-
-#ifndef _
-#if HAVE_GETTEXT - 0
-#define _(msgid) gettext(msgid)
-#else /* !(HAVE_GETTEXT - 0) */
-#define _(msgid) msgid
-#endif /* !(HAVE_GETTEXT - 0) */
-#endif /* !defined _ */
-
-#ifndef TZ_DOMAIN
-#define TZ_DOMAIN "tz"
-#endif /* !defined TZ_DOMAIN */
-
-#if HAVE_INCOMPATIBLE_CTIME_R
-#undef asctime_r
-#undef ctime_r
-char *asctime_r P((struct tm const *, char *));
-char *ctime_r P((time_t const *, char *));
-#endif /* HAVE_INCOMPATIBLE_CTIME_R */
+#define _(msgid) (msgid)
/*
** UNIX was a registered trademark of The Open Group in 2003.
-#ifndef lint
-#ifndef NOID
-static char elsieid[] = "@(#)scheck.c 8.15";
-#endif /* !defined lint */
-#endif /* !defined NOID */
-
-/*LINTLIBRARY*/
+#include "postgres.h"
#include "private.h"
-char *
-scheck(string, format)
-const char * const string;
-const char * const format;
+
+char *scheck(const char *string, const char *format)
{
register char * fbuf;
register const char * fp;
--- /dev/null
+/*
+** Copyright (c) 1989 The Regents of the University of California.
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms are permitted
+** provided that the above copyright notice and this paragraph are
+** duplicated in all such forms and that any documentation,
+** advertising materials, and other materials related to such
+** distribution and use acknowledge that the software was developed
+** by the University of California, Berkeley. The name of the
+** University may not be used to endorse or promote products derived
+** from this software without specific prior written permission.
+** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+#include "postgres.h"
+
+#include <fcntl.h>
+#include <locale.h>
+
+#include "pgtz.h"
+#include "private.h"
+#include "tzfile.h"
+
+
+struct lc_time_T {
+ const char * mon[MONSPERYEAR];
+ const char * month[MONSPERYEAR];
+ const char * wday[DAYSPERWEEK];
+ const char * weekday[DAYSPERWEEK];
+ const char * X_fmt;
+ const char * x_fmt;
+ const char * c_fmt;
+ const char * am;
+ const char * pm;
+ const char * date_fmt;
+};
+
+#define Locale (&C_time_locale)
+
+static const struct lc_time_T C_time_locale = {
+ {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ }, {
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"
+ }, {
+ "Sun", "Mon", "Tue", "Wed",
+ "Thu", "Fri", "Sat"
+ }, {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ },
+
+ /* X_fmt */
+ "%H:%M:%S",
+
+ /*
+ ** x_fmt
+ ** C99 requires this format.
+ ** Using just numbers (as here) makes Quakers happier;
+ ** it's also compatible with SVR4.
+ */
+ "%m/%d/%y",
+
+ /*
+ ** c_fmt
+ ** C99 requires this format.
+ ** Previously this code used "%D %X", but we now conform to C99.
+ ** Note that
+ ** "%a %b %d %H:%M:%S %Y"
+ ** is used by Solaris 2.3.
+ */
+ "%a %b %e %T %Y",
+
+ /* am */
+ "AM",
+
+ /* pm */
+ "PM",
+
+ /* date_fmt */
+ "%a %b %e %H:%M:%S %Z %Y"
+};
+
+static char * _add (const char *, char *, const char *);
+static char * _conv (int, const char *, char *, const char *);
+static char * _fmt (const char *, const struct pg_tm *, char *, const char *, int *);
+
+#define IN_NONE 0
+#define IN_SOME 1
+#define IN_THIS 2
+#define IN_ALL 3
+
+
+size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
+{
+ char * p;
+ int warn;
+
+ warn = IN_NONE;
+ p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
+ if (p == s + maxsize)
+ return 0;
+ *p = '\0';
+ return p - s;
+}
+
+static char * _fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim, int *warnp)
+{
+ for ( ; *format; ++format) {
+ if (*format == '%') {
+label:
+ switch (*++format) {
+ case '\0':
+ --format;
+ break;
+ case 'A':
+ pt = _add((t->tm_wday < 0 ||
+ t->tm_wday >= DAYSPERWEEK) ?
+ "?" : Locale->weekday[t->tm_wday],
+ pt, ptlim);
+ continue;
+ case 'a':
+ pt = _add((t->tm_wday < 0 ||
+ t->tm_wday >= DAYSPERWEEK) ?
+ "?" : Locale->wday[t->tm_wday],
+ pt, ptlim);
+ continue;
+ case 'B':
+ pt = _add((t->tm_mon < 0 ||
+ t->tm_mon >= MONSPERYEAR) ?
+ "?" : Locale->month[t->tm_mon],
+ pt, ptlim);
+ continue;
+ case 'b':
+ case 'h':
+ pt = _add((t->tm_mon < 0 ||
+ t->tm_mon >= MONSPERYEAR) ?
+ "?" : Locale->mon[t->tm_mon],
+ pt, ptlim);
+ continue;
+ case 'C':
+ /*
+ ** %C used to do a...
+ ** _fmt("%a %b %e %X %Y", t);
+ ** ...whereas now POSIX 1003.2 calls for
+ ** something completely different.
+ ** (ado, 1993-05-24)
+ */
+ pt = _conv((t->tm_year + TM_YEAR_BASE) / 100,
+ "%02d", pt, ptlim);
+ continue;
+ case 'c':
+ {
+ int warn2 = IN_SOME;
+
+ pt = _fmt(Locale->c_fmt, t, pt, ptlim, warnp);
+ if (warn2 == IN_ALL)
+ warn2 = IN_THIS;
+ if (warn2 > *warnp)
+ *warnp = warn2;
+ }
+ continue;
+ case 'D':
+ pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp);
+ continue;
+ case 'd':
+ pt = _conv(t->tm_mday, "%02d", pt, ptlim);
+ continue;
+ case 'E':
+ case 'O':
+ /*
+ ** C99 locale modifiers.
+ ** The sequences
+ ** %Ec %EC %Ex %EX %Ey %EY
+ ** %Od %oe %OH %OI %Om %OM
+ ** %OS %Ou %OU %OV %Ow %OW %Oy
+ ** are supposed to provide alternate
+ ** representations.
+ */
+ goto label;
+ case 'e':
+ pt = _conv(t->tm_mday, "%2d", pt, ptlim);
+ continue;
+ case 'F':
+ pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
+ continue;
+ case 'H':
+ pt = _conv(t->tm_hour, "%02d", pt, ptlim);
+ continue;
+ case 'I':
+ pt = _conv((t->tm_hour % 12) ?
+ (t->tm_hour % 12) : 12,
+ "%02d", pt, ptlim);
+ continue;
+ case 'j':
+ pt = _conv(t->tm_yday + 1, "%03d", pt, ptlim);
+ continue;
+ case 'k':
+ /*
+ ** This used to be...
+ ** _conv(t->tm_hour % 12 ?
+ ** t->tm_hour % 12 : 12, 2, ' ');
+ ** ...and has been changed to the below to
+ ** match SunOS 4.1.1 and Arnold Robbins'
+ ** strftime version 3.0. That is, "%k" and
+ ** "%l" have been swapped.
+ ** (ado, 1993-05-24)
+ */
+ pt = _conv(t->tm_hour, "%2d", pt, ptlim);
+ continue;
+#ifdef KITCHEN_SINK
+ case 'K':
+ /*
+ ** After all this time, still unclaimed!
+ */
+ pt = _add("kitchen sink", pt, ptlim);
+ continue;
+#endif /* defined KITCHEN_SINK */
+ case 'l':
+ /*
+ ** This used to be...
+ ** _conv(t->tm_hour, 2, ' ');
+ ** ...and has been changed to the below to
+ ** match SunOS 4.1.1 and Arnold Robbin's
+ ** strftime version 3.0. That is, "%k" and
+ ** "%l" have been swapped.
+ ** (ado, 1993-05-24)
+ */
+ pt = _conv((t->tm_hour % 12) ?
+ (t->tm_hour % 12) : 12,
+ "%2d", pt, ptlim);
+ continue;
+ case 'M':
+ pt = _conv(t->tm_min, "%02d", pt, ptlim);
+ continue;
+ case 'm':
+ pt = _conv(t->tm_mon + 1, "%02d", pt, ptlim);
+ continue;
+ case 'n':
+ pt = _add("\n", pt, ptlim);
+ continue;
+ case 'p':
+ pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
+ Locale->pm :
+ Locale->am,
+ pt, ptlim);
+ continue;
+ case 'R':
+ pt = _fmt("%H:%M", t, pt, ptlim, warnp);
+ continue;
+ case 'r':
+ pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp);
+ continue;
+ case 'S':
+ pt = _conv(t->tm_sec, "%02d", pt, ptlim);
+ continue;
+ case 's':
+ {
+ struct pg_tm tm;
+ char buf[INT_STRLEN_MAXIMUM(time_t) + 1];
+ time_t mkt;
+
+ tm = *t;
+ mkt = pg_mktime(&tm);
+ if (TYPE_SIGNED(time_t))
+ (void) sprintf(buf, "%ld", (long) mkt);
+ else
+ (void) sprintf(buf, "%lu", (unsigned long) mkt);
+ pt = _add(buf, pt, ptlim);
+ }
+ continue;
+ case 'T':
+ pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp);
+ continue;
+ case 't':
+ pt = _add("\t", pt, ptlim);
+ continue;
+ case 'U':
+ pt = _conv((t->tm_yday + DAYSPERWEEK -
+ t->tm_wday) / DAYSPERWEEK,
+ "%02d", pt, ptlim);
+ continue;
+ case 'u':
+ /*
+ ** From Arnold Robbins' strftime version 3.0:
+ ** "ISO 8601: Weekday as a decimal number
+ ** [1 (Monday) - 7]"
+ ** (ado, 1993-05-24)
+ */
+ pt = _conv((t->tm_wday == 0) ?
+ DAYSPERWEEK : t->tm_wday,
+ "%d", pt, ptlim);
+ continue;
+ case 'V': /* ISO 8601 week number */
+ case 'G': /* ISO 8601 year (four digits) */
+ case 'g': /* ISO 8601 year (two digits) */
+/*
+** From Arnold Robbins' strftime version 3.0: "the week number of the
+** year (the first Monday as the first day of week 1) as a decimal number
+** (01-53)."
+** (ado, 1993-05-24)
+**
+** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn:
+** "Week 01 of a year is per definition the first week which has the
+** Thursday in this year, which is equivalent to the week which contains
+** the fourth day of January. In other words, the first week of a new year
+** is the week which has the majority of its days in the new year. Week 01
+** might also contain days from the previous year and the week before week
+** 01 of a year is the last week (52 or 53) of the previous year even if
+** it contains days from the new year. A week starts with Monday (day 1)
+** and ends with Sunday (day 7). For example, the first week of the year
+** 1997 lasts from 1996-12-30 to 1997-01-05..."
+** (ado, 1996-01-02)
+*/
+ {
+ int year;
+ int yday;
+ int wday;
+ int w;
+
+ year = t->tm_year + TM_YEAR_BASE;
+ yday = t->tm_yday;
+ wday = t->tm_wday;
+ for ( ; ; ) {
+ int len;
+ int bot;
+ int top;
+
+ len = isleap(year) ?
+ DAYSPERLYEAR :
+ DAYSPERNYEAR;
+ /*
+ ** What yday (-3 ... 3) does
+ ** the ISO year begin on?
+ */
+ bot = ((yday + 11 - wday) %
+ DAYSPERWEEK) - 3;
+ /*
+ ** What yday does the NEXT
+ ** ISO year begin on?
+ */
+ top = bot -
+ (len % DAYSPERWEEK);
+ if (top < -3)
+ top += DAYSPERWEEK;
+ top += len;
+ if (yday >= top) {
+ ++year;
+ w = 1;
+ break;
+ }
+ if (yday >= bot) {
+ w = 1 + ((yday - bot) /
+ DAYSPERWEEK);
+ break;
+ }
+ --year;
+ yday += isleap(year) ?
+ DAYSPERLYEAR :
+ DAYSPERNYEAR;
+ }
+ if (*format == 'V')
+ pt = _conv(w, "%02d",
+ pt, ptlim);
+ else if (*format == 'g') {
+ *warnp = IN_ALL;
+ pt = _conv(year % 100, "%02d",
+ pt, ptlim);
+ } else pt = _conv(year, "%04d",
+ pt, ptlim);
+ }
+ continue;
+ case 'v':
+ /*
+ ** From Arnold Robbins' strftime version 3.0:
+ ** "date as dd-bbb-YYYY"
+ ** (ado, 1993-05-24)
+ */
+ pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
+ continue;
+ case 'W':
+ pt = _conv((t->tm_yday + DAYSPERWEEK -
+ (t->tm_wday ?
+ (t->tm_wday - 1) :
+ (DAYSPERWEEK - 1))) / DAYSPERWEEK,
+ "%02d", pt, ptlim);
+ continue;
+ case 'w':
+ pt = _conv(t->tm_wday, "%d", pt, ptlim);
+ continue;
+ case 'X':
+ pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp);
+ continue;
+ case 'x':
+ {
+ int warn2 = IN_SOME;
+
+ pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2);
+ if (warn2 == IN_ALL)
+ warn2 = IN_THIS;
+ if (warn2 > *warnp)
+ *warnp = warn2;
+ }
+ continue;
+ case 'y':
+ *warnp = IN_ALL;
+ pt = _conv((t->tm_year + TM_YEAR_BASE) % 100,
+ "%02d", pt, ptlim);
+ continue;
+ case 'Y':
+ pt = _conv(t->tm_year + TM_YEAR_BASE, "%04d",
+ pt, ptlim);
+ continue;
+ case 'Z':
+ if (t->tm_zone != NULL)
+ pt = _add(t->tm_zone, pt, ptlim);
+ /*
+ ** C99 says that %Z must be replaced by the
+ ** empty string if the time zone is not
+ ** determinable.
+ */
+ continue;
+ case 'z':
+ {
+ int diff;
+ char const * sign;
+
+ if (t->tm_isdst < 0)
+ continue;
+ diff = t->tm_gmtoff;
+ if (diff < 0) {
+ sign = "-";
+ diff = -diff;
+ } else sign = "+";
+ pt = _add(sign, pt, ptlim);
+ diff /= 60;
+ pt = _conv((diff/60)*100 + diff%60,
+ "%04d", pt, ptlim);
+ }
+ continue;
+ case '+':
+ pt = _fmt(Locale->date_fmt, t, pt, ptlim,
+ warnp);
+ continue;
+ case '%':
+ /*
+ ** X311J/88-090 (4.12.3.5): if conversion char is
+ ** undefined, behavior is undefined. Print out the
+ ** character itself as printf(3) also does.
+ */
+ default:
+ break;
+ }
+ }
+ if (pt == ptlim)
+ break;
+ *pt++ = *format;
+ }
+ return pt;
+}
+
+static char * _conv(const int n, const char *format, char *pt, const char *ptlim)
+{
+ char buf[INT_STRLEN_MAXIMUM(int) + 1];
+
+ (void) sprintf(buf, format, n);
+ return _add(buf, pt, ptlim);
+}
+
+static char *_add(const char *str, char *pt, const char *ptlim)
+{
+ while (pt < ptlim && (*pt = *str++) != '\0')
+ ++pt;
+ return pt;
+}
** Thank you!
*/
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-static char tzfilehid[] = "@(#)tzfile.h 7.14";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
/*
** Information about time zone files.
*/
-#ifndef TZDIR
-#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */
-#endif /* !defined TZDIR */
-
-#ifndef TZDEFAULT
#define TZDEFAULT "localtime"
-#endif /* !defined TZDEFAULT */
-
-#ifndef TZDEFRULES
#define TZDEFRULES "posixrules"
-#endif /* !defined TZDEFRULES */
/*
** Each file begins with. . .
** exceed any of the limits below.
*/
-#ifndef TZ_MAX_TIMES
/*
** The TZ_MAX_TIMES value below is enough to handle a bit more than a
** year's worth of solar time (corrected daily to the nearest second) or
** (where there are three time zone transitions every fourth year).
*/
#define TZ_MAX_TIMES 370
-#endif /* !defined TZ_MAX_TIMES */
-#ifndef TZ_MAX_TYPES
-#ifndef NOSOLAR
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
-#endif /* !defined NOSOLAR */
-#ifdef NOSOLAR
-/*
-** Must be at least 14 for Europe/Riga as of Jan 12 1995,
-** as noted by Earl Chew <earl@hpato.aus.hp.com>.
-*/
-#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
-#endif /* !defined NOSOLAR */
-#endif /* !defined TZ_MAX_TYPES */
-#ifndef TZ_MAX_CHARS
#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
/* (limited by what unsigned chars can hold) */
-#endif /* !defined TZ_MAX_CHARS */
-#ifndef TZ_MAX_LEAPS
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
-#endif /* !defined TZ_MAX_LEAPS */
#define SECSPERMIN 60
#define MINSPERHOUR 60
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-#ifndef USG
-
-/*
-** Use of the underscored variants may cause problems if you move your code to
-** certain System-V-based systems; for maximum portability, use the
-** underscore-free variants. The underscored variants are provided for
-** backward compatibility only; they may disappear from future versions of
-** this file.
-*/
-
-#define SECS_PER_MIN SECSPERMIN
-#define MINS_PER_HOUR MINSPERHOUR
-#define HOURS_PER_DAY HOURSPERDAY
-#define DAYS_PER_WEEK DAYSPERWEEK
-#define DAYS_PER_NYEAR DAYSPERNYEAR
-#define DAYS_PER_LYEAR DAYSPERLYEAR
-#define SECS_PER_HOUR SECSPERHOUR
-#define SECS_PER_DAY SECSPERDAY
-#define MONS_PER_YEAR MONSPERYEAR
-
-#endif /* !defined USG */
-
#endif /* !defined TZFILE_H */
-static char elsieid[] = "@(#)zic.c 7.115";
+#include "postgres.h"
+
+#include <locale.h>
+
#include "pgtz.h"
-#undef unlink
-#undef TZDIR
-#define TZDIR "data"
+#include "private.h"
+#include "tzfile.h"
+
#ifdef WIN32
+#undef unlink
#include <windows.h>
#endif
-#include "private.h"
-#include "locale.h"
-#include "tzfile.h"
-
-#if HAVE_SYS_STAT_H
-#include "sys/stat.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
#endif
+
#ifndef WIN32
#ifdef S_IRUSR
#define MKDIR_UMASK (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
#endif
#endif
-/*
- * This allows zic to compile by just assigning a dummy value.
- * pgtz.c references it, but no one uses it from zic.
- */
-char my_exec_path[MAXPGPATH] = "";
+static char elsieid[] = "@(#)zic.c 7.115";
/*
** On some ancient hosts, predicates like `isspace(C)' are defined
** For portability, we check both ancient and modern requirements.
** If isascii is not defined, the isascii check succeeds trivially.
*/
-#include "ctype.h"
+#include <ctype.h>
#ifndef isascii
#define isascii(x) 1
#endif
time_t z_untiltime;
};
-extern int getopt P((int argc, char * const argv[],
- const char * options));
-extern int link P((const char * fromname, const char * toname));
-extern char * optarg;
-extern int optind;
-
-static void addtt P((time_t starttime, int type));
-static int addtype P((long gmtoff, const char * abbr, int isdst,
- int ttisstd, int ttisgmt));
-static void leapadd P((time_t t, int positive, int rolling, int count));
-static void adjleap P((void));
-static void associate P((void));
-static int ciequal P((const char * ap, const char * bp));
-static void convert P((long val, char * buf));
-static void dolink P((const char * fromfile, const char * tofile));
-static void doabbr P((char * abbr, const char * format,
- const char * letters, int isdst));
-static void eat P((const char * name, int num));
-static void eats P((const char * name, int num,
- const char * rname, int rnum));
-static long eitol P((int i));
-static void error P((const char * message));
-static char ** getfields P((char * buf));
-static long gethms P((const char * string, const char * errstrng,
- int signable));
-static void infile P((const char * filename));
-static void inleap P((char ** fields, int nfields));
-static void inlink P((char ** fields, int nfields));
-static void inrule P((char ** fields, int nfields));
-static int inzcont P((char ** fields, int nfields));
-static int inzone P((char ** fields, int nfields));
-static int inzsub P((char ** fields, int nfields, int iscont));
-static int itsabbr P((const char * abbr, const char * word));
-static int itsdir P((const char * name));
-static int lowerit P((int c));
-static char * memcheck P((char * tocheck));
-static int mkdirs P((char * filename));
-static void newabbr P((const char * abbr));
-static long oadd P((long t1, long t2));
-static void outzone P((const struct zone * zp, int ntzones));
-static void puttzcode P((long code, FILE * fp));
-static int rcomp P((const void * leftp, const void * rightp));
-static time_t rpytime P((const struct rule * rp, int wantedy));
-static void rulesub P((struct rule * rp,
+extern int link (const char * fromname, const char * toname);
+static void addtt (time_t starttime, int type);
+static int addtype (long gmtoff, const char * abbr, int isdst,
+ int ttisstd, int ttisgmt);
+static void leapadd (time_t t, int positive, int rolling, int count);
+static void adjleap (void);
+static void associate (void);
+static int ciequal (const char * ap, const char * bp);
+static void convert (long val, char * buf);
+static void dolink (const char * fromfile, const char * tofile);
+static void doabbr (char * abbr, const char * format,
+ const char * letters, int isdst);
+static void eat (const char * name, int num);
+static void eats (const char * name, int num,
+ const char * rname, int rnum);
+static long eitol (int i);
+static void error (const char * message);
+static char ** getfields (char * buf);
+static long gethms (const char * string, const char * errstrng,
+ int signable);
+static void infile (const char * filename);
+static void inleap (char ** fields, int nfields);
+static void inlink (char ** fields, int nfields);
+static void inrule (char ** fields, int nfields);
+static int inzcont (char ** fields, int nfields);
+static int inzone (char ** fields, int nfields);
+static int inzsub (char ** fields, int nfields, int iscont);
+static int itsabbr (const char * abbr, const char * word);
+static int itsdir (const char * name);
+static int lowerit (int c);
+static char * memcheck (char * tocheck);
+static int mkdirs (char * filename);
+static void newabbr (const char * abbr);
+static long oadd (long t1, long t2);
+static void outzone (const struct zone * zp, int ntzones);
+static void puttzcode (long code, FILE * fp);
+static int rcomp (const void * leftp, const void * rightp);
+static time_t rpytime (const struct rule * rp, int wantedy);
+static void rulesub (struct rule * rp,
const char * loyearp, const char * hiyearp,
const char * typep, const char * monthp,
- const char * dayp, const char * timep));
-static void setboundaries P((void));
-static time_t tadd P((time_t t1, long t2));
-static void usage P((void));
-static void writezone P((const char * name));
-static int yearistype P((int year, const char * type));
-
-#if !(HAVE_STRERROR - 0)
-static char * strerror P((int));
-#endif /* !(HAVE_STRERROR - 0) */
+ const char * dayp, const char * timep);
+static void setboundaries (void);
+static time_t tadd (time_t t1, long t2);
+static void usage (void);
+static void writezone (const char * name);
+static int yearistype (int year, const char * type);
+
+#ifndef HAVE_STRERROR
+static char * strerror (int);
+#endif
static int charcnt;
static int errors;
const int l_value;
};
-static struct lookup const * byword P((const char * string,
- const struct lookup * lp));
+static struct lookup const * byword (const char * string,
+ const struct lookup * lp);
static struct lookup const line_codes[] = {
{ "Rule", LC_RULE },
** Error handling.
*/
-#if !(HAVE_STRERROR - 0)
-static char *
-strerror(errnum)
-int errnum;
+#ifndef HAVE_STRERROR
+static char *strerror(int errnum)
{
extern char * sys_errlist[];
extern int sys_nerr;
return (errnum > 0 && errnum <= sys_nerr) ?
sys_errlist[errnum] : _("Unknown system error");
}
-#endif /* !(HAVE_STRERROR - 0) */
-
-static void
-eats(name, num, rname, rnum)
-const char * const name;
-const int num;
-const char * const rname;
-const int rnum;
+#endif
+
+static void eats(const char *name, const int num, const char *rname, const int rnum)
{
filename = name;
linenum = num;
rlinenum = rnum;
}
-static void
-eat(name, num)
-const char * const name;
-const int num;
+static void eat(const char *name, const int num)
{
eats(name, num, (char *) NULL, -1);
}
-static void
-error(string)
-const char * const string;
+static void error(const char *string)
{
/*
** Match the format of "cc" to allow sh users to
++errors;
}
-static void
-warning(string)
-const char * const string;
+static void warning(const char *string)
{
char * cp;
--errors;
}
-static void
-usage P((void))
+static void usage(void)
{
(void) fprintf(stderr, _("%s: usage is %s [ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
progname, progname);
static const char * yitcommand;
static int sflag = FALSE;
-int
-main(argc, argv)
-int argc;
-char * argv[];
+int main(int argc, char *argv[])
{
register int i;
register int j;
register int c;
-#ifdef unix
+#ifndef WIN32
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
-#endif /* defined unix */
-#if HAVE_GETTEXT - 0
- (void) setlocale(LC_MESSAGES, "");
-#ifdef TZ_DOMAINDIR
- (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
-#endif /* defined TEXTDOMAINDIR */
- (void) textdomain(TZ_DOMAIN);
-#endif /* HAVE_GETTEXT - 0 */
+#endif /* !WIN32 */
progname = argv[0];
for (i = 1; i < argc; ++i)
if (strcmp(argv[i], "--version") == 0) {
if (optind == argc - 1 && strcmp(argv[optind], "=") == 0)
usage(); /* usage message by request */
if (directory == NULL)
- directory = TZDIR;
+ directory = "data";
if (yitcommand == NULL)
yitcommand = "yearistype";
return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
-static void
-dolink(fromfile, tofile)
-const char * const fromfile;
-const char * const tofile;
+static void dolink(const char *fromfile, const char *tofile)
{
register char * fromname;
register char * toname;
(void) exit(EXIT_FAILURE);
result = link(fromname, toname);
-#if (HAVE_SYMLINK - 0)
+#ifdef HAVE_SYMLINK
if (result != 0 &&
access(fromname, F_OK) == 0 &&
!itsdir(fromname)) {
#define MAX_BITS_IN_FILE 32
#define TIME_T_BITS_IN_FILE ((TYPE_BIT(time_t) < MAX_BITS_IN_FILE) ? TYPE_BIT(time_t) : MAX_BITS_IN_FILE)
-static void
-setboundaries P((void))
+static void setboundaries(void)
{
if (TYPE_SIGNED(time_t)) {
min_time = ~ (time_t) 0;
max_time <<= TIME_T_BITS_IN_FILE - 1;
--max_time;
}
- min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
- max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
+ min_year = TM_YEAR_BASE + pg_gmtime(&min_time)->tm_year;
+ max_year = TM_YEAR_BASE + pg_gmtime(&max_time)->tm_year;
min_year_representable = min_year;
max_year_representable = max_year;
}
-static int
-itsdir(name)
-const char * const name;
+static int itsdir(const char *name)
{
register char * myname;
register int accres;
** Sort by rule name.
*/
-static int
-rcomp(cp1, cp2)
-const void * cp1;
-const void * cp2;
+static int rcomp(const void *cp1, const void *cp2)
{
return strcmp(((const struct rule *) cp1)->r_name,
((const struct rule *) cp2)->r_name);
}
-static void
-associate P((void))
+static void associate(void)
{
register struct zone * zp;
register struct rule * rp;
(void) exit(EXIT_FAILURE);
}
-static void
-infile(name)
-const char * name;
+static void infile(const char *name)
{
register FILE * fp;
register char ** fields;
** Call error with errstring and return zero on errors.
*/
-static long
-gethms(string, errstring, signable)
-const char * string;
-const char * const errstring;
-const int signable;
+static long gethms(const char *string, const char *errstring, const int signable)
{
int hh, mm, ss, sign;
eitol(SECSPERMIN) + eitol(ss));
}
-static void
-inrule(fields, nfields)
-register char ** const fields;
-const int nfields;
+static void inrule(register char **fields, const int nfields)
{
static struct rule r;
rules[nrules++] = r;
}
-static int
-inzone(fields, nfields)
-register char ** const fields;
-const int nfields;
+static int inzone(register char **fields, const int nfields)
{
register int i;
static char * buf;
return inzsub(fields, nfields, FALSE);
}
-static int
-inzcont(fields, nfields)
-register char ** const fields;
-const int nfields;
+static int inzcont(register char **fields, const int nfields)
{
if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS) {
error(_("wrong number of fields on Zone continuation line"));
return inzsub(fields, nfields, TRUE);
}
-static int
-inzsub(fields, nfields, iscont)
-register char ** const fields;
-const int nfields;
-const int iscont;
+static int inzsub(register char **fields, const int nfields, const int iscont)
{
register char * cp;
static struct zone z;
return hasuntil;
}
-static void
-inleap(fields, nfields)
-register char ** const fields;
-const int nfields;
+static void inleap(register char **fields, const int nfields)
{
register const char * cp;
register const struct lookup * lp;
}
}
-static void
-inlink(fields, nfields)
-register char ** const fields;
-const int nfields;
+static void inlink(register char **fields, const int nfields)
{
struct link l;
links[nlinks++] = l;
}
-static void
-rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep)
-register struct rule * const rp;
-const char * const loyearp;
-const char * const hiyearp;
-const char * const typep;
-const char * const monthp;
-const char * const dayp;
-const char * const timep;
+static void rulesub(register struct rule *rp, const char *loyearp, const char *hiyearp, const char *typep, const char *monthp, const char *dayp, const char *timep)
{
register const struct lookup * lp;
register const char * cp;
ifree(dp);
}
-static void
-convert(val, buf)
-const long val;
-char * const buf;
+static void convert(const long val, char *buf)
{
register int i;
register long shift;
buf[i] = val >> shift;
}
-static void
-puttzcode(val, fp)
-const long val;
-FILE * const fp;
+static void puttzcode(const long val, FILE *fp)
{
char buf[4];
(void) fwrite((void *) buf, (size_t) sizeof buf, (size_t) 1, fp);
}
-static int
-atcomp(avp, bvp)
-void * avp;
-void * bvp;
+static int atcomp(const void *avp,const void *bvp)
{
if (((struct attype *) avp)->at < ((struct attype *) bvp)->at)
return -1;
else return 0;
}
-static void
-writezone(name)
-const char * const name;
+static void writezone(const char *name)
{
register FILE * fp;
register int i, j;
}
}
-static void
-doabbr(abbr, format, letters, isdst)
-char * const abbr;
-const char * const format;
-const char * const letters;
-const int isdst;
+static void doabbr(char *abbr, const char *format, const char *letters, const int isdst)
{
if (strchr(format, '/') == NULL) {
if (letters == NULL)
}
}
-static void
-outzone(zpfirst, zonecount)
-const struct zone * const zpfirst;
-const int zonecount;
+static void outzone(const struct zone *zpfirst, const int zonecount)
{
register const struct zone * zp;
register struct rule * rp;
register int i, j;
register int usestart, useuntil;
- register time_t starttime, untiltime;
+ register time_t starttime = 0;
+ register time_t untiltime = 0;
register long gmtoff;
register long stdoff;
register int year;
register int type;
char startbuf[BUFSIZ];
- INITIALIZE(untiltime);
- INITIALIZE(starttime);
/*
** Now. . .finally. . .generate some useful data!
*/
}
for ( ; ; ) {
register int k;
- register time_t jtime, ktime;
+ register time_t jtime, ktime = 0;
register long offset;
char buf[BUFSIZ];
- INITIALIZE(ktime);
if (useuntil) {
/*
** Turn untiltime into UTC
writezone(zpfirst->z_name);
}
-static void
-addtt(starttime, type)
-const time_t starttime;
-int type;
+static void addtt(const time_t starttime, int type)
{
if (starttime <= min_time ||
(timecnt == 1 && attypes[0].at < min_time)) {
++timecnt;
}
-static int
-addtype(gmtoff, abbr, isdst, ttisstd, ttisgmt)
-const long gmtoff;
-const char * const abbr;
-const int isdst;
-const int ttisstd;
-const int ttisgmt;
+static int addtype(const long gmtoff, const char *abbr, const int isdst, const int ttisstd, const int ttisgmt)
{
register int i, j;
return i;
}
-static void
-leapadd(t, positive, rolling, count)
-const time_t t;
-const int positive;
-const int rolling;
-int count;
+static void leapadd(const time_t t, const int positive, const int rolling, int count)
{
register int i, j;
} while (positive && --count != 0);
}
-static void
-adjleap P((void))
+static void adjleap(void)
{
register int i;
register long last = 0;
}
}
-static int
-yearistype(year, type)
-const int year;
-const char * const type;
+static int yearistype(const int year, const char *type)
{
static char * buf;
int result;
(void) exit(EXIT_FAILURE);
}
-static int
-lowerit(a)
-int a;
+static int lowerit(int a)
{
a = (unsigned char) a;
return (isascii(a) && isupper(a)) ? tolower(a) : a;
}
-static int
-ciequal(ap, bp) /* case-insensitive equality */
-register const char * ap;
-register const char * bp;
+static int ciequal(register const char *ap, register const char *bp)
{
while (lowerit(*ap) == lowerit(*bp++))
if (*ap++ == '\0')
return FALSE;
}
-static int
-itsabbr(abbr, word)
-register const char * abbr;
-register const char * word;
+static int itsabbr(register const char *abbr, register const char *word)
{
if (lowerit(*abbr) != lowerit(*word))
return FALSE;
return TRUE;
}
-static const struct lookup *
-byword(word, table)
-register const char * const word;
-register const struct lookup * const table;
+static const struct lookup *byword(register const char *word, register const struct lookup *table)
{
register const struct lookup * foundlp;
register const struct lookup * lp;
return foundlp;
}
-static char **
-getfields(cp)
-register char * cp;
+static char **getfields(register char *cp)
{
register char * dp;
register char ** array;
return array;
}
-static long
-oadd(t1, t2)
-const long t1;
-const long t2;
+static long oadd(const long t1, const long t2)
{
register long t;
return t;
}
-static time_t
-tadd(t1, t2)
-const time_t t1;
-const long t2;
+static time_t tadd(const time_t t1, const long t2)
{
register time_t t;
** 1970, 00:00 LOCAL time - in that year that the rule refers to.
*/
-static time_t
-rpytime(rp, wantedy)
-register const struct rule * const rp;
-register const int wantedy;
+static time_t rpytime(register const struct rule *rp, register const int wantedy)
{
register int y, m, i;
register long dayoff; /* with a nod to Margaret O. */
return tadd(t, rp->r_tod);
}
-static void
-newabbr(string)
-const char * const string;
+static void newabbr(const char *string)
{
register int i;
charcnt += eitol(i);
}
-static int
-mkdirs(argname)
-char * const argname;
+static int mkdirs(char *argname)
{
register char * name;
register char * cp;
cp = name = ecpyalloc(argname);
while ((cp = strchr(cp + 1, '/')) != 0) {
*cp = '\0';
-#ifndef unix
+#ifdef WIN32
/*
** DOS drive specifier?
*/
*cp = '/';
continue;
}
-#endif /* !defined unix */
+#endif /* WIN32 */
if (!itsdir(name)) {
/*
** It doesn't seem to exist, so we try to create it.
return 0;
}
-static long
-eitol(i)
-const int i;
+static long eitol(const int i)
{
long l;
return 0;
}
#endif
+
+/*
+ * This allows zic to compile by just assigning a dummy value.
+ * localtime.c references it, but no one uses it from zic.
+ */
+char *
+pg_TZDIR(void)
+{
+ return NULL;
+}