andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.77k stars 201 forks source link

datefmt() function adds an hour to the actual time. #849

Open niceiq opened 10 months ago

niceiq commented 10 months ago

This issue has been annoying me for the past hour or so. I am just getting into date and time input with sc-im, but I haven't found anything on my issue.

I have the following string cell: 2023.10.02 9:56:32, I formatted it using datefmt %Y.%m.%d %H:%M%S, but I have the following result: 2023.10.02 10:56:32.

As you can see, the 9 became 10.

I'm sure it's someting silly and I'm either blind or stupid, but some help would be appreciated!

andmarti1424 commented 10 months ago

What do you have in set in tm_gmtoff configuration variable..? You may have to adjust it. EDIT: if you are off by an hour try reducing it or increasing it by 3600..

niceiq commented 10 months ago

The issue persists. I tried adding and subtracting 3600, but neither has any effect.

andmarti1424 commented 10 months ago

What value do you have configured?

niceiq commented 10 months ago

image

The default value is 10800, I had it set at both 7200 and 14400 (+- 3600). datefmt stills shows the wrong hour.

andmarti1424 commented 10 months ago

I wonder if this has something to do with your LOCALE

niceiq commented 10 months ago

I don't know.

The output of date is Wed Oct 4 16:10:05 EDT 2023. I am in the right timezone in everything.

It's the epoch timestamp that it gets wrong when I do datefmt from the string.

image

But when I convert the same date using date on my system, it works fine:

image

niceiq commented 10 months ago

I wonder if this has something to do with your LOCALE

I think it has something to do with my timezone.

I am currently on Eastern Daylight Time, which of course, adds an hour to to my time during the summer.

image

However, the date command on my system outputs the right thing, but it looks like the datefmt() command in sc-im is confused with that. Is there a way in the config to zet the time zone to EST? I think this might fix the issue.

Thank you.

marrs commented 1 month ago

What's the output of locale | grep LC_TIME in your shell?