Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1e6457df
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1e6457df
编写于
12月 01, 2004
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix timestamptz_age() to do calculation in local timezone not GMT, per bug 1332.
上级
4828445d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
14 deletion
+20
-14
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/timestamp.c
+20
-14
未找到文件。
src/backend/utils/adt/timestamp.c
浏览文件 @
1e6457df
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.11
5 2004/11/20 22:12:44
tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.11
6 2004/12/01 19:57:49
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -17,7 +17,6 @@
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
...
...
@@ -2352,25 +2351,25 @@ timestamp_age(PG_FUNCTION_ARGS)
tm
->
tm_year
=
-
tm
->
tm_year
;
}
if
(
tm
->
tm_sec
<
0
)
while
(
tm
->
tm_sec
<
0
)
{
tm
->
tm_sec
+=
60
;
tm
->
tm_min
--
;
}
if
(
tm
->
tm_min
<
0
)
while
(
tm
->
tm_min
<
0
)
{
tm
->
tm_min
+=
60
;
tm
->
tm_hour
--
;
}
if
(
tm
->
tm_hour
<
0
)
while
(
tm
->
tm_hour
<
0
)
{
tm
->
tm_hour
+=
24
;
tm
->
tm_mday
--
;
}
if
(
tm
->
tm_mday
<
0
)
while
(
tm
->
tm_mday
<
0
)
{
if
(
dt1
<
dt2
)
{
...
...
@@ -2384,7 +2383,7 @@ timestamp_age(PG_FUNCTION_ARGS)
}
}
if
(
tm
->
tm_mon
<
0
)
while
(
tm
->
tm_mon
<
0
)
{
tm
->
tm_mon
+=
12
;
tm
->
tm_year
--
;
...
...
@@ -2437,11 +2436,14 @@ timestamptz_age(PG_FUNCTION_ARGS)
*
tm1
=
&
tt1
;
struct
pg_tm
tt2
,
*
tm2
=
&
tt2
;
int
tz1
;
int
tz2
;
char
*
tzn
;
result
=
(
Interval
*
)
palloc
(
sizeof
(
Interval
));
if
((
timestamp2tm
(
dt1
,
NULL
,
tm1
,
&
fsec1
,
NULL
)
==
0
)
&&
(
timestamp2tm
(
dt2
,
NULL
,
tm2
,
&
fsec2
,
NULL
)
==
0
))
if
((
timestamp2tm
(
dt1
,
&
tz1
,
tm1
,
&
fsec1
,
&
tzn
)
==
0
)
&&
(
timestamp2tm
(
dt2
,
&
tz2
,
tm2
,
&
fsec2
,
&
tzn
)
==
0
))
{
fsec
=
(
fsec1
-
fsec2
);
tm
->
tm_sec
=
(
tm1
->
tm_sec
-
tm2
->
tm_sec
);
...
...
@@ -2463,25 +2465,25 @@ timestamptz_age(PG_FUNCTION_ARGS)
tm
->
tm_year
=
-
tm
->
tm_year
;
}
if
(
tm
->
tm_sec
<
0
)
while
(
tm
->
tm_sec
<
0
)
{
tm
->
tm_sec
+=
60
;
tm
->
tm_min
--
;
}
if
(
tm
->
tm_min
<
0
)
while
(
tm
->
tm_min
<
0
)
{
tm
->
tm_min
+=
60
;
tm
->
tm_hour
--
;
}
if
(
tm
->
tm_hour
<
0
)
while
(
tm
->
tm_hour
<
0
)
{
tm
->
tm_hour
+=
24
;
tm
->
tm_mday
--
;
}
if
(
tm
->
tm_mday
<
0
)
while
(
tm
->
tm_mday
<
0
)
{
if
(
dt1
<
dt2
)
{
...
...
@@ -2495,12 +2497,16 @@ timestamptz_age(PG_FUNCTION_ARGS)
}
}
if
(
tm
->
tm_mon
<
0
)
while
(
tm
->
tm_mon
<
0
)
{
tm
->
tm_mon
+=
12
;
tm
->
tm_year
--
;
}
/*
* Note: we deliberately ignore any difference between tz1 and tz2.
*/
/* recover sign if necessary... */
if
(
dt1
<
dt2
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录