unsoluble / smalltime

A small FoundryVTT module for displaying and controlling the current time of day.
MIT License
24 stars 15 forks source link

[BUG] Multiple GM's and Simple Calendar's Time Controls #72

Closed vigoren closed 3 years ago

vigoren commented 3 years ago

A bit of a weird edge case issue for you. I'm not sure exactly what is going on but when there are multiple GMs connected to a game and one of the GMs attempts to update the time using SC's time controls the update is immediately undone. This only happens when the minutes or hours are updated (second, day, month and year changes are unaffected by this bug).

When using SmallTime's controls the time updates correctly.

If I disable SmallTime using SC's controls updates correctly.

How I replicated is:

What I noticed when trying to pinpoint this bug is that right after my update SC is receiving another update from the "updateWorldTime" hook set to the old time.

You can see this happening if you run this bit of code in the console then try the tests

Hooks.on("updateWorldTime", (newTime, delta) => {console.log((`World Time Update, new time: ${newTime}. Delta of: ${delta}.`));});

Advancing the time by 1 minute with that hook enabled will result in something like this appearing in the console.

World Time Update, new time: 1625805391. Delta of: 60.
World Time Update, new time: 1625805331. Delta of: -60.

I ran into this bug so thought I would let you know. I haven't received any complaints about it so it may be a very niche scenario but if its not too hard of a fix that would be ideal.

unsoluble commented 3 years ago

Interesting. To be honest, I've done next to zero testing with multiple GM logins; just hasn't been a priority. I imagine it's something fairly simple in the socket chain that's causing this. Might not have a chance to investigate for a while, but will when I can. Thanks for the heads-up!

unsoluble commented 3 years ago

This was actually happening in more cases than just a second GM present, but I think I sorted it out in 1.11.2. Thanks again for the ticket. :)