Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ca256f32
Commit
ca256f32
authored
Jul 22, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More spacing adjustments
parent
75e5aba7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/timestamp.c
+18
-15
No files found.
src/backend/utils/adt/timestamp.c
View file @
ca256f32
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.1
39 2005/07/22 03:46:34
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.1
40 2005/07/22 15:15:38
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -3944,11 +3944,13 @@ timestamp_zone(PG_FUNCTION_ARGS)
...
@@ -3944,11 +3944,13 @@ timestamp_zone(PG_FUNCTION_ARGS)
PG_RETURN_TIMESTAMPTZ
(
timestamp
);
PG_RETURN_TIMESTAMPTZ
(
timestamp
);
/* Find the specified timezone? */
/* Find the specified timezone? */
len
=
(
VARSIZE
(
zone
)
-
VARHDRSZ
>
TZ_STRLEN_MAX
)
?
TZ_STRLEN_MAX
:
(
VARSIZE
(
zone
)
-
VARHDRSZ
);
len
=
(
VARSIZE
(
zone
)
-
VARHDRSZ
>
TZ_STRLEN_MAX
)
?
memcpy
(
tzname
,
VARDATA
(
zone
),
len
);
TZ_STRLEN_MAX
:
VARSIZE
(
zone
)
-
VARHDRSZ
;
memcpy
(
tzname
,
VARDATA
(
zone
),
len
);
tzname
[
len
]
=
0
;
tzname
[
len
]
=
0
;
tzp
=
pg_tzset
(
tzname
);
tzp
=
pg_tzset
(
tzname
);
if
(
!
tzp
)
{
if
(
!
tzp
)
{
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"time zone
\"
%s
\"
not recognised"
,
errmsg
(
"time zone
\"
%s
\"
not recognised"
,
...
@@ -3958,7 +3960,8 @@ timestamp_zone(PG_FUNCTION_ARGS)
...
@@ -3958,7 +3960,8 @@ timestamp_zone(PG_FUNCTION_ARGS)
/* Apply the timezone change */
/* Apply the timezone change */
if
(
timestamp2tm
(
timestamp
,
&
tz
,
&
tm
,
&
fsec
,
NULL
,
tzp
)
!=
0
||
if
(
timestamp2tm
(
timestamp
,
&
tz
,
&
tm
,
&
fsec
,
NULL
,
tzp
)
!=
0
||
tm2timestamp
(
&
tm
,
fsec
,
NULL
,
&
result
)
!=
0
)
{
tm2timestamp
(
&
tm
,
fsec
,
NULL
,
&
result
)
!=
0
)
{
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"could not convert to time zone
\"
%s
\"
"
,
errmsg
(
"could not convert to time zone
\"
%s
\"
"
,
...
@@ -3966,7 +3969,7 @@ timestamp_zone(PG_FUNCTION_ARGS)
...
@@ -3966,7 +3969,7 @@ timestamp_zone(PG_FUNCTION_ARGS)
PG_RETURN_NULL
();
PG_RETURN_NULL
();
}
}
PG_RETURN_TIMESTAMPTZ
(
timestamp2timestamptz
(
result
));
PG_RETURN_TIMESTAMPTZ
(
timestamp2timestamptz
(
result
));
}
/* timestamp_zone() */
}
/* timestamp_izone()
/* timestamp_izone()
* Encode timestamp type with specified time interval as time zone.
* Encode timestamp type with specified time interval as time zone.
...
@@ -4022,7 +4025,6 @@ timestamp2timestamptz(Timestamp timestamp)
...
@@ -4022,7 +4025,6 @@ timestamp2timestamptz(Timestamp timestamp)
if
(
TIMESTAMP_NOT_FINITE
(
timestamp
))
if
(
TIMESTAMP_NOT_FINITE
(
timestamp
))
result
=
timestamp
;
result
=
timestamp
;
else
else
{
{
if
(
timestamp2tm
(
timestamp
,
NULL
,
tm
,
&
fsec
,
NULL
,
NULL
)
!=
0
)
if
(
timestamp2tm
(
timestamp
,
NULL
,
tm
,
&
fsec
,
NULL
,
NULL
)
!=
0
)
...
@@ -4057,7 +4059,6 @@ timestamptz_timestamp(PG_FUNCTION_ARGS)
...
@@ -4057,7 +4059,6 @@ timestamptz_timestamp(PG_FUNCTION_ARGS)
if
(
TIMESTAMP_NOT_FINITE
(
timestamp
))
if
(
TIMESTAMP_NOT_FINITE
(
timestamp
))
result
=
timestamp
;
result
=
timestamp
;
else
else
{
{
if
(
timestamp2tm
(
timestamp
,
&
tz
,
tm
,
&
fsec
,
&
tzn
,
NULL
)
!=
0
)
if
(
timestamp2tm
(
timestamp
,
&
tz
,
tm
,
&
fsec
,
&
tzn
,
NULL
)
!=
0
)
...
@@ -4082,7 +4083,6 @@ timestamptz_zone(PG_FUNCTION_ARGS)
...
@@ -4082,7 +4083,6 @@ timestamptz_zone(PG_FUNCTION_ARGS)
text
*
zone
=
PG_GETARG_TEXT_P
(
0
);
text
*
zone
=
PG_GETARG_TEXT_P
(
0
);
TimestampTz
timestamp
=
PG_GETARG_TIMESTAMPTZ
(
1
);
TimestampTz
timestamp
=
PG_GETARG_TIMESTAMPTZ
(
1
);
Timestamp
result
;
Timestamp
result
;
int
tz
;
int
tz
;
pg_tz
*
tzp
;
pg_tz
*
tzp
;
char
tzname
[
TZ_STRLEN_MAX
];
char
tzname
[
TZ_STRLEN_MAX
];
...
@@ -4094,12 +4094,14 @@ timestamptz_zone(PG_FUNCTION_ARGS)
...
@@ -4094,12 +4094,14 @@ timestamptz_zone(PG_FUNCTION_ARGS)
PG_RETURN_NULL
();
PG_RETURN_NULL
();
/* Find the specified zone */
/* Find the specified zone */
len
=
(
VARSIZE
(
zone
)
-
VARHDRSZ
>
TZ_STRLEN_MAX
)
?
TZ_STRLEN_MAX
:
(
VARSIZE
(
zone
)
-
VARHDRSZ
);
len
=
(
VARSIZE
(
zone
)
-
VARHDRSZ
>
TZ_STRLEN_MAX
)
?
memcpy
(
tzname
,
VARDATA
(
zone
),
len
);
TZ_STRLEN_MAX
:
VARSIZE
(
zone
)
-
VARHDRSZ
;
memcpy
(
tzname
,
VARDATA
(
zone
),
len
);
tzname
[
len
]
=
0
;
tzname
[
len
]
=
0
;
tzp
=
pg_tzset
(
tzname
);
tzp
=
pg_tzset
(
tzname
);
if
(
!
tzp
)
{
if
(
!
tzp
)
{
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"time zone
\"
%s
\"
not recognized"
,
tzname
)));
errmsg
(
"time zone
\"
%s
\"
not recognized"
,
tzname
)));
...
@@ -4108,7 +4110,8 @@ timestamptz_zone(PG_FUNCTION_ARGS)
...
@@ -4108,7 +4110,8 @@ timestamptz_zone(PG_FUNCTION_ARGS)
}
}
if
(
timestamp2tm
(
timestamp
,
&
tz
,
&
tm
,
&
fsec
,
NULL
,
tzp
)
!=
0
||
if
(
timestamp2tm
(
timestamp
,
&
tz
,
&
tm
,
&
fsec
,
NULL
,
tzp
)
!=
0
||
tm2timestamp
(
&
tm
,
fsec
,
NULL
,
&
result
))
{
tm2timestamp
(
&
tm
,
fsec
,
NULL
,
&
result
))
{
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"could not to convert to time zone
\"
%s
\"
"
,
tzname
)));
errmsg
(
"could not to convert to time zone
\"
%s
\"
"
,
tzname
)));
...
@@ -4116,7 +4119,7 @@ timestamptz_zone(PG_FUNCTION_ARGS)
...
@@ -4116,7 +4119,7 @@ timestamptz_zone(PG_FUNCTION_ARGS)
}
}
PG_RETURN_TIMESTAMP
(
result
);
PG_RETURN_TIMESTAMP
(
result
);
}
/* timestamptz_zone() */
}
/* timestamptz_izone()
/* timestamptz_izone()
* Encode timestamp with time zone type with specified time interval as time zone.
* Encode timestamp with time zone type with specified time interval as time zone.
...
@@ -4149,4 +4152,4 @@ timestamptz_izone(PG_FUNCTION_ARGS)
...
@@ -4149,4 +4152,4 @@ timestamptz_izone(PG_FUNCTION_ARGS)
result
=
dt2local
(
timestamp
,
tz
);
result
=
dt2local
(
timestamp
,
tz
);
PG_RETURN_TIMESTAMP
(
result
);
PG_RETURN_TIMESTAMP
(
result
);
}
/* timestamptz_izone() */
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment