now static method

Future<DateTime> now({
  1. String lookUpAddress = _defaultLookup,
  2. int port = 123,
  3. Duration? timeout,
})

Get current NTP time

Implementation

static Future<DateTime> now({
  String lookUpAddress = _defaultLookup,
  int port = 123,
  Duration? timeout,
}) async {
  final DateTime localTime = DateTime.now();
  final int offset = await getNtpOffset(
    lookUpAddress: lookUpAddress,
    port: port,
    localTime: localTime,
    timeout: timeout,
  );

  return localTime.add(Duration(milliseconds: offset));
}