fix: complete logical clock wall-time isolation
This commit is contained in:
@@ -42,8 +42,12 @@ type CardItem = {
|
||||
type GeneralPoolResponse = {
|
||||
result: true,
|
||||
pick: CardItem[],
|
||||
validUntil: string,
|
||||
}
|
||||
validUntil: string,
|
||||
validForSeconds: number,
|
||||
clockMode: "realtime" | "manual",
|
||||
}
|
||||
|
||||
let logicalClockRunning = true;
|
||||
|
||||
declare const characterInfo: Record<string, { name: string, info: string }>;
|
||||
declare const hasGeneralID: number;
|
||||
@@ -185,7 +189,10 @@ async function buildGeneral(e: JQuery.Event) {
|
||||
location.href = './';
|
||||
}
|
||||
|
||||
function updateOutdateTimer() {
|
||||
function updateOutdateTimer() {
|
||||
if (!logicalClockRunning) {
|
||||
return;
|
||||
}
|
||||
const $validUntilText = $('#valid_until_text');
|
||||
const now = Date.now();
|
||||
const validUntil = $validUntilText.data('until');
|
||||
@@ -204,10 +211,11 @@ function updateOutdateTimer() {
|
||||
setTimeout(updateOutdateTimer, 1000);
|
||||
}
|
||||
|
||||
function printGenerals(value: GeneralPoolResponse) {
|
||||
function printGenerals(value: GeneralPoolResponse) {
|
||||
logicalClockRunning = value.clockMode === "realtime";
|
||||
$('.card_holder').empty();
|
||||
$('#valid_until').show();
|
||||
$('#valid_until_text').html(value.validUntil).data('until', (new Date(value.validUntil)).getTime()).css('color', 'white');
|
||||
$('#valid_until_text').html(value.validUntil).data('until', Date.now() + value.validForSeconds * 1000).css('color', 'white');
|
||||
$('#outdate_token').hide();
|
||||
|
||||
const pick = value.pick.map(v => v);//XXX: 의도가 뭐였지? clone?
|
||||
|
||||
Reference in New Issue
Block a user