fromWallClock static method

DateTime fromWallClock(
  1. DateTime wall
)

Wiener Wanduhrzeit (naives DateTime) → echter Zeitpunkt (UTC).

Implementation

static DateTime fromWallClock(DateTime wall) {
  final base = DateTime.utc(wall.year, wall.month, wall.day, wall.hour,
      wall.minute, wall.second, wall.millisecond, wall.microsecond);
  // Erst Sommerzeit annehmen; stimmt die Annahme für den resultierenden
  // Zeitpunkt, war sie richtig — sonst gilt Winterzeit.
  final summer = base.subtract(const Duration(hours: 2));
  if (_isSummerTime(summer)) return summer;
  return base.subtract(const Duration(hours: 1));
}