Anki due cards will not sync between phone and computer (it's not buried cards and the delta is huge)

I’m traveling in Japan. I did my flashcards on my laptop which is still set to EST whereas my phone has auto updated to Japan time. This causes the syncing function to fail because after doing my cards on my laptop in EST (14 hours prior - which would have been yesterday) causes my phone to then try to do those cards as if it is the future.

This is a bug. Anki should be using UTC time under the hood for these purposes and not local device time. Better, at sync time it should just use NTP.

Original Problem Description:

I have a deck on the iPhone app that has 381 reviews due, with 112 reviews due in a subdeck, and 34 new cards.

On the desktop app I have everything finished. I have manually unburied all cards on the desktop app to guarantee this isn’t the cause of the delta.

I forced a one way sync from the desktop app to the cloud and then pulled on my phone.

That still didn’t work so I deleted the app off my phone and then reinstalled and it still has hundreds of reviews that do not exist on the desktop app.

I’ve also tried rebuilding the database.

Is there something else I’m missing that could account for such a large discrepancy?

You said “will not sync” and “causes the syncing function to fail” – but it sounds like you are actually running sync and it is completing, right? There’s no “cannot sync because device time is different”-type of error?

Then I would expect that the collections on your devices are synced, and Anki is just showing you correct information based on your device time/date. Anki stores those due dates as days-since a fixed point (collection creation). But if your laptop is telling Anki it is 7:57pm on 15 May, and your phone is telling Anki is it 8:57am on 16 May, Anki can be using the same database and presenting what is correct for both situations.

Take a look at one of those 381 “due” Reviews on both devices – is the due date 16 May? Take a look at a card you studied on 15 May on both devices (rated:1 on your laptop, rated:2 on your phone) – does it show review history from 15 May? What if you manually change your phone back to EST – does everything match your laptop now? If so, you can just choose which time(/date)-zone you want to be in when you’re studying and study what’s due.

Yes, it would complete the sync, but since my laptop was in EST (which Anki sees as a day behind) I would do my flashcards, on the laptop, sync them, and then my phone, instead of accurately reflecting there were NO flashcards to do, would show the next day’s flashcards because Anki saw this as being a day later (because Japan is 13 hours ahead of EST)

This is a bug. Software should never rely on system time for such functions. The calculation for day should be done using UTC under the hood. IE: when I do a sync, Anki should check the UTC time the sync was completed and then sync based on that time. IE: if my laptop is synced at 2300 EST (which is a day behind) and then seconds later I hit sync on my phone where it is 1200 JST Anki should correctly identify that the phone isn’t somehow 13 hours in the future and that the resulting sync should completely sync both devices.

The behavior today is that Anki thinks that because my cutoff for a day is 0300, it believes erroneously the phone is a day in the future so doing the cards on the laptop is like going back in the past and doing the cards.

This could be handled appropriately in any number of ways. Prompting the user about the discrepancy, simply warning the user so they know what is going on so at least they aren’t lost as to why the phone won’t sync (seemingly), or any number of other combinations.

What it definitely shouldn’t do is pretend the flashcards were done in the past and then propagate the changes into the future based on displayed clock time with no warning.

I’m not going to debate with you about whether it’s possible to use “UTC under the hood” to calculate dates with a variable start-of-day time – because I just think your use case is too unique. You’re trying to exist and study in 2 separate time zones at the same time, and you want Anki to accommodate that. But it’s more likely that users will want for Anki to deal reasonably with time-zone shifts/travel – which it does quite well.

The very simple solution for you (again) is to pick your study time zone, and put your device in that time zone when you want to study on it.

2 Likes

Dates are stored as UTC internally, and the local timezone is applied in real time. If you don’t have all your devices set to the same timezone, then you’re going to get cards shown at different times.

1 Like

So my question is - how does a not computer savvy user know that?

I just fired up my laptop without thinking. I travel a lot and I don’t bother adjusting the timezone for a few days for each trip. I was baffled when I finished up the cards on the laptop, hit sync, but then noticed later that the numbers on my phone were completely different.

I eventually figured out what was going on because I work in computer science and this is about the billionth time NTP/time in general has caused problems for me, but your average user does not in my experience put that together. If device one syncs at what it thinks is 2300EST -1 day and then immediately after there is a sync at 1200JST that is very obviously not someone who has just warped themselves 13 hours into the future.

If the app isn’t going to just roll with UTC under the hood (which I understand not doing), I do think it should say something about the discrepancy and if nothing else, just issue an informational statement so the user knows what they’re looking at.

I guess we’ll cross that bridge user when we come to them? :person_shrugging:t4: I don’t think you have to be computer-savvy to work this one out – just clock-savvy. It’s just like how a calendar changes when you travel. Typical users travel with their cell phones and laptops across time zones and date-lines too – so they experience these same things.

If a typical user looks at one device that says it’s in the US and today, and another device that says it’s in Japan and tomorrow – I don’t think they would be surprised to see differences in scheduling.

I think it’s good practice to put an alert saying the time zone has changed. Given that I’m not a programmer, I don’t know how hard that is to add.

I believe that most people sync every clock when they travel.

I also feel that the syncing schedule should be at the local time. People usually sleep at night even while traveling, and the learning day should change while sleeping.