92673c99d8
The previous implementation interpreted the creation date as a local time, and applied the rollover to that. If the initial creation date was around midnight local time, even a one hour change due to daylight savings could result in Anki skipping or doubling up on a day. To address this, the rollover is now applied to the current time instead of the creation date. The new code needs the current time passed into it. This makes it easier to unit test, and for AnkiWeb to be able to use the user's local timezone. The new timezone code is currently disabled, as this code needs to be ported to all clients before it can be activated.
90 lines
1.6 KiB
Protocol Buffer
90 lines
1.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package backend_proto;
|
|
|
|
message Empty {}
|
|
|
|
// 1-15 reserved for future use; 2047 for errors
|
|
|
|
message BackendInput {
|
|
reserved 2047;
|
|
oneof value {
|
|
TemplateRequirementsIn template_requirements = 16;
|
|
SchedTimingTodayIn sched_timing_today = 17;
|
|
|
|
PlusOneIn plus_one = 2046; // temporary, for testing
|
|
|
|
}
|
|
}
|
|
|
|
message BackendOutput {
|
|
oneof value {
|
|
TemplateRequirementsOut template_requirements = 16;
|
|
SchedTimingTodayOut sched_timing_today = 17;
|
|
|
|
PlusOneOut plus_one = 2046; // temporary, for testing
|
|
|
|
BackendError error = 2047;
|
|
}
|
|
}
|
|
|
|
message BackendError {
|
|
oneof value {
|
|
InvalidInputError invalid_input = 1;
|
|
TemplateParseError template_parse = 2;
|
|
}
|
|
}
|
|
|
|
message InvalidInputError {
|
|
string info = 1;
|
|
}
|
|
|
|
message PlusOneIn {
|
|
int32 num = 1;
|
|
}
|
|
|
|
message PlusOneOut {
|
|
int32 num = 1;
|
|
}
|
|
|
|
message TemplateParseError {
|
|
string info = 1;
|
|
}
|
|
|
|
message TemplateRequirementsIn {
|
|
repeated string template_front = 1;
|
|
map<string, uint32> field_names_to_ordinals = 2;
|
|
}
|
|
|
|
message TemplateRequirementsOut {
|
|
repeated TemplateRequirement requirements = 1;
|
|
}
|
|
|
|
message TemplateRequirement {
|
|
oneof value {
|
|
TemplateRequirementAll all = 1;
|
|
TemplateRequirementAny any = 2;
|
|
Empty none = 3;
|
|
}
|
|
}
|
|
|
|
message TemplateRequirementAll {
|
|
repeated uint32 ords = 1;
|
|
}
|
|
|
|
message TemplateRequirementAny {
|
|
repeated uint32 ords = 1;
|
|
}
|
|
|
|
message SchedTimingTodayIn {
|
|
int64 created = 1;
|
|
int64 now = 2;
|
|
sint32 minutes_west = 3;
|
|
sint32 rollover_hour = 4;
|
|
}
|
|
|
|
message SchedTimingTodayOut {
|
|
uint32 days_elapsed = 1;
|
|
int64 next_day_at = 2;
|
|
}
|