Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looks like Flamerobin is subtracting the timezone again or something like that. #338

Open
arvanus opened this issue Oct 17, 2023 · 15 comments

Comments

@arvanus
Copy link
Collaborator

arvanus commented Oct 17, 2023

image
--set time zone 'America/Sao_paulo';
--set bind of time with time zone to legacy;
--set bind of timestamp with time zone to legacy;
select localtime, current_time, CURRENT_TIMESTAMP from rdb$database

Both columns should have the same timestamp value for Fb4+

@arvanus
Copy link
Collaborator Author

arvanus commented Oct 17, 2023

See more here:
FirebirdSQL/firebird#7806 (comment)

@arvanus
Copy link
Collaborator Author

arvanus commented Oct 17, 2023

Note: Flamerobin is NOT subtracting the TZ

@mrotteveel
Copy link

As I also commented on the issue on the Firebird tracker, it looks like FlameRobin is showing the UTC time.

@arvanus
Copy link
Collaborator Author

arvanus commented Oct 18, 2023

@andy-123 can you take a look?
Looks like we need to load ICU someway, and convert every single field to the specific offset taking account the timezone and time itself
I don't know if we can do it using directly fbclient.dll or just by using ICU dll
For now I'm thinking to change Flamerobin behavior to always show time as GMT+0:00 to avoid misinterpretation of the value

@andy-123
Copy link
Contributor

I'm sorry for being late. I hope to find time for this in the next few weeks.

@arvanus
Copy link
Collaborator Author

arvanus commented Nov 22, 2023

Note: probably the correct place to change it could be at IBPP source, not sure

@andy-123
Copy link
Contributor

See PR (Draft) #362 for current state.

@andy-123
Copy link
Contributor

andy-123 commented Jan 4, 2024

@arvanus
The PR #362 is almost finished. Unfortunately, the time displayed (localtime/current_time) in the time zone "America/Sao_Paulo" does not match what isql shows. (See also the description in the PR).

It's unclear to me where the BUG comes from.
When debugging isql, I noticed that the DST (Daylight save time) for America/Sao_Paulo is added here. This is responsible for the one hour difference. Sao_Paulo abolished the DST in 2019. This indicates an outdated ICU version. However, my linux and also fbclient/isql seem to have a current version of ICU.
And why is isql correct?
I currently have no idea how to solve this problem. Maybe someone here can help and/or give a good hint or something.

@arvanus
Copy link
Collaborator Author

arvanus commented Jan 4, 2024

Hi, I'll take a look what it could be ASAP
Thanks

@andy-123
Copy link
Contributor

andy-123 commented Jan 4, 2024

Thank you.
Maybe this is still helpful:
It depends on the DST (Daylight saving time). With PR #362 applied, the time is displayed correctly if you subtract or add 1/2 year.
grafik

@arvanus
Copy link
Collaborator Author

arvanus commented Jan 4, 2024

SO, I tried this SQL in a "legacy" Firebird 4.0


select  localtime, localtimestamp, current_time, CURRENT_TIMESTAMP, 
        cast(localtime as varchar(42)) as cast_localtime, 
        cast(localtimestamp as varchar(42)) as cast_localtimestamp, 
        cast(current_time as varchar(42)) as cast_current_time, 
        cast(CURRENT_TIMESTAMP as varchar(42)) as cast_CURRENT_TIMESTAMP
      from rdb$database

And is showing the same time correctly
image

BUT in another server I get the time with +1Hour, very strange :

image

(also in isql)
image

When I try in another server with timezone (America/Sao_paulo) manually defined in the conf , I get another behaviour

image
image

Note: I'm in a hurry now, so maybe I missed something

@andy-123
Copy link
Contributor

andy-123 commented Jan 4, 2024

Thanks for testing. Very strange, ...
Is isql embedded or connected via network? I suspect that this makes a difference.
In the first isql query, the time zone is displayed as "-3:00". This could be a problem loading the ICU library.

@arvanus
Copy link
Collaborator Author

arvanus commented Jan 4, 2024

Via network, remote servers.
Also noted that if the server is using the default OS timezone, or is using a fixed in firebird.conf equal to the OS timezone I get different results somehow

@arvanus
Copy link
Collaborator Author

arvanus commented Jan 5, 2024

@andy-123 I found some strange behavior related with manually setting DefaultTimeZone = America/Sao_paulo
When not defined the output is correct, but the TZ is odd

I submitted a post at firebird-support
https://groups.google.com/g/firebird-support/c/5FA5R8Pjvog/m/EBqlQ-AwAwAJ

SQL:

select  localtime, current_time, 
        cast(localtime as varchar(42)) as cast_localtime, 
        cast(current_time as varchar(42)) as cast_current_time
    from rdb$database

with DefaultTimeZone =
image

with DefaultTimeZone = America/Sao_paulo
image

@andy-123
Copy link
Contributor

I created a small Lazarus project that has the same time problem as flamerobin. I have created a support request for this.
https://groups.google.com/g/firebird-support/c/vic0_wwpOVw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants