Set the Update Time from the local clock (in UTC)
192406
def set_update_time(self, update_time=None):
        
        if update_time and isinstance(update_time, (datetime.datetime,)):
            self.last_update_time = update_time
        else:
            self.last_update_time = datetime.datetime.utcnow()
1219576
def to_utc(value, defaulttz=None):
    
    if defaulttz is None:
        defaulttz = tzlocal()
    return _convert(value, tzutc(), defaulttz)
1258703
public static void setUtc(Date time) {
		setClock(Clock.fixed(time.toInstant(), ZoneId.of("UTC")));
	}
1012624
def getTimeSinceLastUpdate(IOType):
    """"""
    global last_update_times
    # assert(IOType in ['net', 'disk', 'process_disk'])
    current_time = time()
    last_time = last_update_times.get(IOType)
    if not last_time:
        time_since_update = 1
    else:
        time_since_update = current_time - last_time
    last_update_times[IOType] = current_time
    return time_since_update
757933
def from_timestamp(timestamp, tz_offset):
    """"""
    utc_dt = datetime.fromtimestamp(timestamp, utc)
    try:
        local_dt = utc_dt.astimezone(tzoffset(tz_offset))
        return local_dt
    except ValueError:
        return utc_dt
878877
def __set_timestamp(self, clock):
        
        if clock is None:
            unix_timestamp = time.mktime(
                datetime.datetime.now().utctimetuple()
            )
            timestamp = int(unix_timestamp)

            return timestamp

        else:
            return clock
941030
def set_timestamp(self, timestamp=str(datetime.datetime.utcfromtimestamp(time.time()))):
        
        self.timestamp = timestamp
1026646
def set_current_time(self, t):
        

        method = "set_current_time"

        A = None
        metadata = {method: t}

        send_array(self.socket, A, metadata)
        A, metadata = recv_array(
            self.socket, poll=self.poll, poll_timeout=self.poll_timeout,
            flags=self.zmq_flags)
867551
def to_localtime(time):
    ''''''

    utc_time = time.replace(tzinfo=timezone.utc)
    to_zone = timezone.get_default_timezone()
    return utc_time.astimezone(to_zone)
114451
def update_current_time(loop):
    
    global current_time
    current_time = time()
    loop.call_later(1, partial(update_current_time, loop))
1359082
def sync_time(self):
        """"""
        now = time.localtime(time.time())
        self.remote(set_time, (now.tm_year, now.tm_mon, now.tm_mday, now.tm_wday + 1,
                               now.tm_hour, now.tm_min, now.tm_sec, 0))
        return now
1098815
def _mark_updated(self):
        """"""
        timestamp = datetime.datetime.utcnow().isoformat()
        DB.set_hash_value(self.key, 'updated', timestamp)
1287352
def utcfromtimestamp(cls, t):
        ""
        t, frac = divmod(t, 1.0)
        us = int(frac * 1e6)

        # If timestamp is less than one microsecond smaller than a
        # full second, us can be rounded up to 1000000.  In this case,
        # roll over to seconds, otherwise, ValueError is raised
        # by the constructor.
        if us == 1000000:
            t += 1
            us = 0
        y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t)
        ss = min(ss, 59)    # clamp out leap seconds if the platform has them
        return cls(y, m, d, hh, mm, ss, us)
1297452
def utcnow_ts():
    """"""
    if utcnow.override_time is None:
        # NOTE(kgriffs): This is several times faster
        # than going through calendar.timegm(...)
        return int(time.time())

    return calendar.timegm(utcnow().timetuple())
152224
public void setLocalTime(long time)
  {
    // If this is a local time zone date, just set the time
    if (_timeZone != _gmtTimeZone) {
      calculateSplit(time);
    }
    // If this is a GMT date, convert from local to GMT
    else {
      calculateSplit(time - _localTimeZone.getRawOffset());

      try {
        long offset = _localTimeZone.getOffset(GregorianCalendar.AD,
                                               (int) _year,
                                               (int) _month,
                                               (int) _dayOfMonth + 1,
                                               getDayOfWeek(),
                                               (int) _timeOfDay);

        calculateSplit(time - offset);
      } catch (Exception e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }
  }
639084
def fromtimestamp(cls, timestamp):
    """"""
    d = cls.utcfromtimestamp(timestamp)
    return d.astimezone(localtz())
284255
def update(self):
        """"""
        # Had to convert it to string because datetime is not JSON serializable
        self.stats = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        # Add the time zone (issue #1249 and issue #1337)
        if 'tmzone' in localtime():
            self.stats += ' {}'.format(localtime().tm_zone)
        elif len(tzname) > 0:
            self.stats += ' {}'.format(tzname[1])

        return self.stats