getTimeZone method

double getTimeZone()

获取当前时间系统的本地时区

Implementation

double getTimeZone() {
  DateTime local = DateTime.now();
  DateTime localUtc = local.toUtc();
  DateTime nowUtc = DateTime.utc(local.year, local.month, local.day,
      local.hour, local.minute, local.second);
  DateTime utc = DateTime.utc(localUtc.year, localUtc.month, localUtc.day,
      localUtc.hour, localUtc.minute, localUtc.second);
  Duration d = nowUtc.difference(utc);
  return d.inMinutes / 60.0;
}