now static method
Get current NTP time
Implementation
static Future<DateTime?> now({
String? lookUpAddress,
int? port,
Duration? timeout,
}) async {
try {
final DateTime localTime = DateTime.now();
final int? offset = await getNtpOffset(
lookUpAddress: lookUpAddress ?? _defaultLookup,
port: port ?? 123,
localTime: localTime,
timeout: timeout,
);
if (offset == null) {
debugPrint("⚠️ Falling back: NTP server time.");
return null; // caller (TrueTimeProvider) handles fallback
}
return localTime.add(Duration(milliseconds: offset));
} catch (e) {
debugPrint("❌ NTP now() failed: $e");
return null; // caller handles fallback
}
}