mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 22:43:26 +01:00
Make "Last seen" handle year rollover correctly
This commit is contained in:
parent
4365b8d5ad
commit
e722b665d1
@ -975,7 +975,10 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
|||||||
uint64_t last_seen = Friends.list[f].last_online.last_on;
|
uint64_t last_seen = Friends.list[f].last_online.last_on;
|
||||||
|
|
||||||
if (last_seen != 0) {
|
if (last_seen != 0) {
|
||||||
int day_dist = (cur_loc_tm.tm_yday - Friends.list[f].last_online.tm.tm_yday) % 365;
|
int day_dist = (
|
||||||
|
cur_loc_tm.tm_yday - Friends.list[f].last_online.tm.tm_yday
|
||||||
|
+ ((cur_loc_tm.tm_year - Friends.list[f].last_online.tm.tm_year) * 365)
|
||||||
|
) % 365;
|
||||||
const char *hourmin = Friends.list[f].last_online.hour_min_str;
|
const char *hourmin = Friends.list[f].last_online.hour_min_str;
|
||||||
|
|
||||||
switch (day_dist) {
|
switch (day_dist) {
|
||||||
|
Loading…
Reference in New Issue
Block a user