Temporarily set the current time offset.
163966
def set_time_offset(self, offset, is_utc):
        """"""

        is_utc = bool(is_utc)
        self.clock_manager.time_offset = offset
        self.clock_manager.is_utc = is_utc

        return [Error.NO_ERROR]
216498
@Override
    public void setRawOffset(int offsetMillis) {
        if (isFrozen()) {
            throw new UnsupportedOperationException("Attempt to modify a frozen OlsonTimeZone instance.");
        }

        if (getRawOffset() == offsetMillis) {
            return;
        }
        long current = System.currentTimeMillis();

        if (current < finalStartMillis) {
            SimpleTimeZone stz = new SimpleTimeZone(offsetMillis, getID());

            boolean bDst = useDaylightTime();
            if (bDst) {
                TimeZoneRule[] currentRules = getSimpleTimeZoneRulesNear(current);
                if (currentRules.length != 3) {
                    // DST was observed at the beginning of this year, so useDaylightTime
                    // returned true.  getSimpleTimeZoneRulesNear requires at least one
                    // future transition for making a pair of rules.  This implementation
                    // rolls back the time before the latest offset transition.
                    TimeZoneTransition tzt = getPreviousTransition(current, false);
                    if (tzt != null) {
                        currentRules = getSimpleTimeZoneRulesNear(tzt.getTime() - 1);
                    }
                }
                if (currentRules.length == 3
                        && (currentRules[1] instanceof AnnualTimeZoneRule)
                        && (currentRules[2] instanceof AnnualTimeZoneRule)) {
                    // A pair of AnnualTimeZoneRule
                    AnnualTimeZoneRule r1 = (AnnualTimeZoneRule)currentRules[1];
                    AnnualTimeZoneRule r2 = (AnnualTimeZoneRule)currentRules[2];
                    DateTimeRule start, end;
                    int offset1 = r1.getRawOffset() + r1.getDSTSavings();
                    int offset2 = r2.getRawOffset() + r2.getDSTSavings();
                    int sav;
                    if (offset1 > offset2) {
                        start = r1.getRule();
                        end = r2.getRule();
                        sav = offset1 - offset2;
                    } else {
                        start = r2.getRule();
                        end = r1.getRule();
                        sav = offset2 - offset1;
                    }
                    // getSimpleTimeZoneRulesNear always return rules using DOW / WALL_TIME
                    stz.setStartRule(start.getRuleMonth(), start.getRuleWeekInMonth(), start.getRuleDayOfWeek(),
                                            start.getRuleMillisInDay());
                    stz.setEndRule(end.getRuleMonth(), end.getRuleWeekInMonth(), end.getRuleDayOfWeek(),
                                            end.getRuleMillisInDay());
                    // set DST saving amount and start year
                    stz.setDSTSavings(sav);
                } else {
                    // This could only happen if last rule is DST
                    // and the rule used forever.  For example, Asia/Dhaka
                    // in tzdata2009i stays in DST forever.

                    // Hack - set DST starting at midnight on Jan 1st,
                    // ending 23:59:59.999 on Dec 31st
                    stz.setStartRule(0, 1, 0);
                    stz.setEndRule(11, 31, Grego.MILLIS_PER_DAY - 1);
                }
            }

            int[] fields = Grego.timeToFields(current, null);

            finalStartYear = fields[0];
            finalStartMillis = Grego.fieldsToDay(fields[0], 0, 1);

            if (bDst) {
                // we probably do not need to set start year of final rule
                // to finalzone itself, but we always do this for now.
                stz.setStartYear(finalStartYear);
            }

            finalZone = stz;

        } else {
            finalZone.setRawOffset(offsetMillis);
        }

        transitionRulesInitialized = false;
    }
677851
def set_options(
        self,
        time_reset: int = 60,
        time_repeat: int = 0,
        repeat: int = 0,
        changes: int = 10,
    ) -> None:
        """"""
        self._time_reset = time_reset
        self._time_repeat = time_repeat
        self._repeat = repeat
        self._changes = changes
1343465
def set_current(self, value):
        '''
        
        '''
        self.current = value
        self.cursor = 0
        self.limit = len(self.current)
        self.limit_backward = 0
        self.bra = self.cursor
        self.ket = self.limit
1244473
def _min_timezone_offset():
    ""
    now = time.time()
    return (datetime.datetime.fromtimestamp(now) - datetime.datetime.utcfromtimestamp(now)).seconds // 60
336686
def utcoffset(self, dt):
        
        if self.__is_daylight_time(dt):
            return self.__dst_offset
        else:
            return self.__offset
1110700
def update_offset(self, new_offset):
        
        self.offset = new_offset
        self.data_points = self._data_points[self.offset:]
        self.timestamps = self._timestamps[self.offset:]
840366
def set_time(self, key_name, new_time):
        """"""
        self.unbake()
        kf = self.dct[key_name]
        kf['time'] = new_time
        self.bake()
73995
def pass_time(self, t):
        """"""
        cont = time.time() + t
        while time.time() < cont:
            time.sleep(0)
844134
def milliseconds_offset(cls, timestamp, now=None):
        
        if isinstance(timestamp, (int, float)):
            base = timestamp
        else:
            base = cls.to_unix(timestamp)
            base += (timestamp.microsecond / 1000000)
        if now is None:
            now = time.time()
        return (now - base) * 1000
1331517
def _maybe_apply_time_shift(da, time_offset=None, **DataAttrs):
        """"""
        if time_offset is not None:
            time = times.apply_time_offset(da[TIME_STR], **time_offset)
            da[TIME_STR] = time
        return da
520640
def current_offset(local_tz=None):
    
    if local_tz is None:
        local_tz = DEFAULT_LOCAL_TZ
    dt = local_tz.localize(datetime.now())
    return dt.utcoffset()
644881
def reset(self, value=None):
    

    if value is None:
      value = time.clock()
    self.start = value
    if self.value_on_reset:
      self.value = self.value_on_reset
204995
def set_dhw_on(self, until=None):
        """"""
        if until is None:
            data = {"Mode": "PermanentOverride",
                    "State": "On",
                    "UntilTime": None}
        else:
            data = {"Mode": "TemporaryOverride",
                    "State": "On",
                    "UntilTime": until.strftime('%Y-%m-%dT%H:%M:%SZ')}

        self._set_dhw(data)
341291
public synchronized void tick() {
        long currentTime = GVRTime.getMilliTime();
        long cutoffTime = currentTime - BUFFER_SECONDS * 1000;
        ListIterator<Long> it = mTimestamps.listIterator();
        while (it.hasNext()) {
            Long timestamp = it.next();
            if (timestamp < cutoffTime) {
                it.remove();
            } else {
                break;
            }
        }

        mTimestamps.add(currentTime);
        mStatColumn.addValue(((float)mTimestamps.size()) / BUFFER_SECONDS);
    }
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
767325
def update(self, pos):
        
        self.pos = pos
        self.now = time.time()