Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-02-2008, 05:06 AM
Andrew Chernow
 
Posts: n/a
Default Odd timezone backend output

I am confused about the below results. The backend is in EDT but it is
converting timestamps into EST ... excluding NOW(). Regardless of the
timezone provided, the backend is dishing out EST.

[root@dev43 ~]# uname -a
2.6.9-67.0.4.EL #1 Sun Feb 3 06:53:29 EST 2008 i686 athlon i386 GNU/Linux

[root@dev43 ~]# date
Thu May 1 09:54:17 EDT 2008

postgres=# select version();
PostgreSQL 8.3devel on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
3.4.6 20060404 (Red Hat 3.4.6-8)

postgres=# set datestyle='Postgres, MDY';
postgres=# select now();
now
-------------------------------------
Thu May 01 09:28:53.164084 2008 EDT

postgres=# select '1997-01-29 12:31:42.92214 EDT'::timestamptz;
timestamptz
------------------------------------
Wed Jan 29 11:31:42.92214 1997 EST

postgres=# select '1997-01-29 12:31:42.92214 PST'::timestamptz;
timestamptz
------------------------------------
Wed Jan 29 15:31:42.92214 1997 EST

Is this expected behavior? I am not sure if I am missing something or
my results are wrong. Is there a setting that needs tweaking?

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-02-2008, 05:06 AM
Tom Lane
 
Posts: n/a
Default Re: Odd timezone backend output

Andrew Chernow <ac@esilo.com> writes:
> I am confused about the below results. The backend is in EDT but it is
> converting timestamps into EST ... excluding NOW(). Regardless of the
> timezone provided, the backend is dishing out EST.


Try a date that's actually during the EDT part of the year.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-02-2008, 05:06 AM
Andrew Sullivan
 
Posts: n/a
Default Re: Odd timezone backend output

On Thu, May 01, 2008 at 09:53:41AM -0400, Andrew Chernow wrote:
> I am confused about the below results. The backend is in EDT but it is
> converting timestamps into EST ... excluding NOW(). Regardless of the
> timezone provided, the backend is dishing out EST.


First, this doesn't really belong on hackers, which is for hacking of
the back end. If you're going to follow up, please take it to
-general or something.

Your client thinks it's in America/Toronto or something similar. You
can set the time zone you're in by SET TIME ZONE (or timezone).
There's a lot more about this in the manual at
<http://www.postgresql.org/docs/8.3/interactive/datatype-datetime.html#DATATYPE-TIMEZONES>

> postgres=# select now();
> now
> -------------------------------------
> Thu May 01 09:28:53.164084 2008 EDT


May is in Daylight time in (AFAIK all) Eastern zones.

> postgres=# select '1997-01-29 12:31:42.92214 EDT'::timestamptz;
> timestamptz
> ------------------------------------
> Wed Jan 29 11:31:42.92214 1997 EST
>
> postgres=# select '1997-01-29 12:31:42.92214 PST'::timestamptz;
> timestamptz
> ------------------------------------
> Wed Jan 29 15:31:42.92214 1997 EST


January is in Standard time in Eastern zones. Note that you asked for
1997-01-29 12:31:42.92214 EDT, and got back what time that would be
_for your actual timezone_. Same thing for the Pacific case.

A

--
Andrew Sullivan
ajs@commandprompt.com
+1 503 667 4564 x104
http://www.commandprompt.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-02-2008, 05:06 AM
Andrew Chernow
 
Posts: n/a
Default Re: Odd timezone backend output

Tom Lane wrote:
> Andrew Chernow <ac@esilo.com> writes:
>> I am confused about the below results. The backend is in EDT but it is
>> converting timestamps into EST ... excluding NOW(). Regardless of the
>> timezone provided, the backend is dishing out EST.

>
> Try a date that's actually during the EDT part of the year.
>
> regards, tom lane
>


Different systems do different things with Daylight time. For instance:
NTFS adjusts winter file times while in daylight savings (A file time of
Jan 20 6PM reads Jan 20 7PM while in Daylight Time). Whether that is
good or bad is a different story. I don't really have a problem with
either, just needed a little clarity.

Thanks,
--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-02-2008, 05:06 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Odd timezone backend output



Andrew Chernow wrote:
> Tom Lane wrote:
>> Andrew Chernow <ac@esilo.com> writes:
>>> I am confused about the below results. The backend is in EDT but it
>>> is converting timestamps into EST ... excluding NOW(). Regardless
>>> of the timezone provided, the backend is dishing out EST.

>>
>> Try a date that's actually during the EDT part of the year.
>>
>> regards, tom lane
>>

>
> Different systems do different things with Daylight time. For
> instance: NTFS adjusts winter file times while in daylight savings (A
> file time of Jan 20 6PM reads Jan 20 7PM while in Daylight Time).
> Whether that is good or bad is a different story. I don't really have
> a problem with either, just needed a little clarity.
>
>


The only file times we should ever be interested in are surely epoch
times, which should be unaffected by time zones.

cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-02-2008, 05:06 AM
Andrew Chernow
 
Posts: n/a
Default Re: Odd timezone backend output

>>NTFS adjusts winter file times while in daylight savings
>
> The only file times we should ever be interested in are surely epoch
> times, which should be unaffected by time zones.
>
> cheers
>
> andrew
>


epoch, or at least non-timezone adjusted times, is the way every modern
FS stores file times, no one said otherwise. There is a big difference
between time storage and display ... I was talking about display.
Postgres deals with both so at some point, a file time (or any time)
will get displayed. There are different ways of handling daylight
display, I have yet to find a technically correct way of doing it.

The more I think about it, I personally like the display behavior of
NTFS file times over something like EXT3. When I am in EDT, it is
useful to have all display times in that zone (regardless of whether
that time falls within winter or summer) ... just as they would if I
switched to PST.

--
andrew chernow
eSilo, LLC.
--every bit counts

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-05-2008, 05:52 AM
Andrew Sullivan
 
Posts: n/a
Default Re: Odd timezone backend output

On Thu, May 01, 2008 at 09:58:09PM -0400, Andrew Chernow wrote:

> The more I think about it, I personally like the display behavior of NTFS
> file times over something like EXT3. When I am in EDT, it is useful to
> have all display times in that zone (regardless of whether that time falls
> within winter or summer) ... just as they would if I switched to PST.


There's a difference between the two cases you're thinking of, though.

In the case of "you being in EDT", you didn't actually switch time
zone. In Eastern time zones, the offset is -05 from UTC for part of
the year, and -04 from UTC from part of the year. That's what it
_means_ to be in Eastern time: you didn't really switch time zone at
all. I'm in America/Toronto in January and in June. My display
should show the time correct to my time zone, not according to the
offset from UTC. If you really want that, change your time zone to be
an offset from UTC rather than a particular zone. (We used to have to
differentiate between EST and EDT during the summer months, because
Indiana didn't switch. As far as I know, there is no longer a single
jurisdiction where the summer time change doesn't happen in Eastern
time. If not for historical reasons, I'd argue the name should be
changed to Eastern time.)

If you switch to Pacific time (and why is it that people say "EDT" but
"PST"? I don't know of any Pacific time jurisdictions that don't
switch, either. Arizona doesn't switch mostly, but they're in
Mountain time), the same thing happens.

A

--
Andrew Sullivan
ajs@commandprompt.com
+1 503 667 4564 x104
http://www.commandprompt.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-05-2008, 05:52 AM
Andrew Chernow
 
Posts: n/a
Default Re: Odd timezone backend output

Andrew Sullivan wrote:
> On Thu, May 01, 2008 at 09:58:09PM -0400, Andrew Chernow wrote:
>
>> The more I think about it, I personally like the display behavior of NTFS
>> file times over something like EXT3. When I am in EDT, it is useful to
>> have all display times in that zone (regardless of whether that time falls
>> within winter or summer) ... just as they would if I switched to PST.

>
> There's a difference between the two cases you're thinking of, though.
>
> In the case of "you being in EDT", you didn't actually switch time
> zone. In Eastern time zones, the offset is -05 from UTC for part of
> the year, and -04 from UTC from part of the year. That's what it
> _means_ to be in Eastern time: you didn't really switch time zone at
> all. I'm in America/Toronto in January and in June. My display
> should show the time correct to my time zone, not according to the
> offset from UTC. If you really want that, change your time zone to be
> an offset from UTC rather than a particular zone. (We used to have to
> differentiate between EST and EDT during the summer months, because
> Indiana didn't switch. As far as I know, there is no longer a single
> jurisdiction where the summer time change doesn't happen in Eastern
> time. If not for historical reasons, I'd argue the name should be
> changed to Eastern time.)
>
> If you switch to Pacific time (and why is it that people say "EDT" but
> "PST"? I don't know of any Pacific time jurisdictions that don't
> switch, either. Arizona doesn't switch mostly, but they're in
> Mountain time), the same thing happens.
>
> A
>


I prefer offset from UTC, the timezone abbrevs are ambiguos and
confusing. If I am in a timezone that is currently 4 hours behind UTC,
I would prefer all times to display adjusted by that offset. I
understand that technically its eastern time and EDT makes no sense in
Jan (NOTE: linux 'date' command rejects this ... should the backend?),
but its friendlier to adjust by a single offset (at least me thinks).
The individual's perception of time is -0400, thus displaying all times
adjusted by that seems logical. My whole preference here is in regards
to display times. I always try to see things from a non-technical
end-user's perspective.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-05-2008, 05:52 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Odd timezone backend output



Andrew Chernow wrote:
>
> I prefer offset from UTC, the timezone abbrevs are ambiguos and
> confusing. If I am in a timezone that is currently 4 hours behind
> UTC, I would prefer all times to display adjusted by that offset. I
> understand that technically its eastern time and EDT makes no sense in
> Jan (NOTE: linux 'date' command rejects this ... should the backend?),
> but its friendlier to adjust by a single offset (at least me thinks).
> The individual's perception of time is -0400, thus displaying all
> times adjusted by that seems logical. My whole preference here is in
> regards to display times. I always try to see things from a
> non-technical end-user's perspective.
>


Well, I think you're failing in this instance :-). If I see a time that
says 4.00 am June 27th tzname I understand it to be with the offset that
was current in that time zone *at that time*. And I certainly don't want
it to change depending on what the *current* offset is in that time zone
- I want it always to display the same. I bet if you take a random
sample of non-technical end-users you'll find that's exactly what the
vast majority want.

cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-05-2008, 05:52 AM
Andrew Sullivan
 
Posts: n/a
Default Re: Odd timezone backend output

On Fri, May 02, 2008 at 09:54:20AM -0400, Andrew Chernow wrote:
> I prefer offset from UTC, the timezone abbrevs are ambiguos and confusing.


So did you read the manual on SET TIME ZONE?

> TIME ZONE


> SET TIME ZONE value is an alias for SET timezone TO value. The
> syntax SET TIME ZONE allows special syntax for the time zone
> specification. Here are examples of valid values:


> 'PST8PDT'


> The time zone for Berkeley, California.
> 'Europe/Rome'


> The time zone for Italy.
> -7


> The time zone 7 hours west from UTC (equivalent to
> PDT). Positive values are east from UTC. INTERVAL '-08:00' HOUR
> TO MINUTE


> The time zone 8 hours west from UTC (equivalent to PST).


A

--
Andrew Sullivan
ajs@commandprompt.com
+1 503 667 4564 x104
http://www.commandprompt.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:33 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784