dmedvinsky / gsimplecal

Simple and lightweight GTK calendar (BSD license)
http://dmedvinsky.github.io/gsimplecal
Other
197 stars 19 forks source link

Completely populate datetime struct for accurate strftime output #46

Closed m-bartlett closed 2 years ago

m-bartlett commented 2 years ago

With the current implementation the "day of the week" is always 0/Sunday since its initialized to 0 and never modified.

My proposed code change populates the day of the week and the other uninitialized attributes in the time struct to produce expected strftime output.

dmedvinsky commented 2 years ago

Thanks a bunch!

m-bartlett commented 2 years ago

Thanks for merging, just a heads up I've observed that this patch has a bug that causes the day of the week to be off by one occasionally, and I'm not exactly sure what the cause is. Expect another PR following up on this from me at some point, but for now it is at least marginally better than always putting the day of the week as Sunday

vaygr commented 2 years ago

For some reason this PR causes build failure with gcc 4.6.4:

Calendar.cpp: In member function 'bool Calendar::runExternalViewer()':
Calendar.cpp:176:13: error: expected primary-expression before '.' token
Calendar.cpp:176:26: error: expected primary-expression before '.' token
Calendar.cpp:176:39: error: expected primary-expression before '.' token
Calendar.cpp:177:13: error: expected primary-expression before '.' token
Calendar.cpp:178:13: error: expected primary-expression before '.' token
Calendar.cpp:179:13: error: expected primary-expression before '.' token
Calendar.cpp:180:13: error: expected primary-expression before '.' token
Calendar.cpp:181:13: error: expected primary-expression before '.' token
Calendar.cpp:182:13: error: expected primary-expression before '.' token
Makefile:391: recipe for target 'Calendar.o' failed
dmedvinsky commented 2 years ago

@m-bartlett would you be willing to give that a look?

m-bartlett commented 2 years ago

@m-bartlett would you be willing to give that a look?

Addressed this in https://github.com/dmedvinsky/gsimplecal/pull/48 although I haven't been able to verify since I wasn't able to make an environment with gcc 4.6.4 and gtk+-3.0 that could link everything successfully.

vaygr commented 2 years ago

This is excellent, thank you both. Tested, works as expected.