mbolli / nfsen-ng

Responsive NetFlow visualizer built on top of nfdump tools.
Apache License 2.0
233 stars 45 forks source link

timezone issue #103

Open mlcarson opened 8 months ago

mlcarson commented 8 months ago

My server is in America/Los_Angeles timezone and is running the latest version of Debian stable. My nfcapd data files are getting the time/date correct. The nfsen-ng v0.3 is using UTC for the frontend graphs. It graphs the data in the correct spot but the current time is being taken from UTC so when I choose the 1 hour option, it'll show nothing because I'm 8 hrs in the future.

I've modified the /etc/php/8.2/apache2/php.ini file so that date.time is set to 'America/Los_Angeles' and restarted the apache2 server. I've also restarted the entire OS and no difference.

BTW, PHP 8.2 is the latest offered by Debian stable so I'm using that rather than 8.3 since 8.2 seemed to still be the minimum supported.

Well, I somehow "solved" this. The graphs are now just showing in UTC time (not exactly what I wanted) but the data is also mapped to UTC so when the last hour of data is shown it's now accurate. This might have been an issue with the /etc/php/8.2/cli/php.ini file. I modified that but hadn't restarted the cli.php daemon so maybe that was it...

So I guess the next question would be -- is there a way of displaying the graphs in the server's local timezone rather than UTC?

mbolli commented 8 months ago

Can you try and set https://github.com/mbolli/nfsen-ng/blob/dea341695c4731076553798f1fdccf2ff50f2c33/backend/api/Api.php#L300 to 0 to see what happens in the frontend?

mlcarson commented 8 months ago

If I set it to zero, there's no difference. If I set it to -8 then the graph appears on local time since that's the offset from GMT.

On Thu, Mar 7, 2024 at 1:45 AM Michael Bolli @.***> wrote:

Can you try and set https://github.com/mbolli/nfsen-ng/blob/dea341695c4731076553798f1fdccf2ff50f2c33/backend/api/Api.php#L300 to 0 to see what happens in the frontend?

— Reply to this email directly, view it on GitHub https://github.com/mbolli/nfsen-ng/issues/103#issuecomment-1982783939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFU4CSRMYVPNE3FDGTIJCZLYXALI7AVCNFSM6AAAAABEKKGXM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBSG44DGOJTHE . You are receiving this because you authored the thread.Message ID: @.***>

mbolli commented 8 months ago

@mlcarson can you try the latest master to see if it's better? We merged PR #105

gardouille commented 2 months ago

Same issue, i was 2 hours in the past (for graphs, statistics…).

I solved this by modifying php.ini just as suggested by @mlcarson :