storeServerTimeOffset method
Future<void>
storeServerTimeOffset(
- SchemaMetaData smd,
- DbTransaction transaction,
- int currentTs,
- int serverTs,
Implementation
Future<void> storeServerTimeOffset(SchemaMetaData smd,
DbTransaction transaction, int currentTs, int serverTs) async {
bool inRange = false;
int timeDifference = serverTs - currentTs;
int serverTimeOffset = await getConfigurationInteger(
smd, transaction, ConfigurationNameEnum.SERVER_TIME_OFFSET) as int;
if ((timeDifference > (serverTimeOffset - _C_SLACK_SECS)) &&
(timeDifference < (serverTimeOffset + _C_SLACK_SECS))) inRange = true;
if (!inRange) {
await setConfigurationInteger(smd, transaction,
ConfigurationNameEnum.SERVER_TIME_OFFSET, timeDifference);
}
print(
"currentTs=$currentTs||serverTs=$serverTs||diff=$timeDifference||stored offset=$serverTimeOffset");
}