Reset the alarm times stored in SharedPreferences following a reboot of the device.
After a reboot, the AlarmManager must be setup again so that periodic replications will
occur following reboot.
481769
private void resetAlarmDueTimesOnReboot() {
        // As the device has been rebooted, we use clock time rather than elapsed time since
        // booting to set check whether we missed any alarms while the device was off and to
        // make sure the next alarm time isn't too far in the future (indicating the system clock
        // has been reset).
        //
        // We subtract the current time from the next expected alarm time and then do the
        // following checks:
        // * If it's less than zero, that means we missed an alarm when the device was off, so
        //   we schedule a replication immediately by setting the last alarm time to a time
        //   getIntervalInSeconds() ago.
        // * If it's more than getIntervalInSeconds() in the future, that means the system clock
        //   has been reset since the last alarm was fired.  Therefore, we check that the initial
        //   interval for the alarm is no later than getIntervalInSeconds() after the
        //   current time so we minimise the impact of the system clock being reset and will at most
        //   have to wait for the normal interval time.
        // * Otherwise, the clock time for the alarm seems reasonable, but we still need to update
        //   the SharedPreference for the elapsed time since boot at which the last alarm would have
        //   fired as that currently refers to the time since boot from the previous boot of the
        //   device.
        //
        // We don't actually setup the AlarmManager here as it is up to the subclass to determine
        // if all other conditions for the replication policy are met and determine whether to
        // restart replications after a reboot.
        setPeriodicReplicationEnabled(false);
        long initialInterval = getNextAlarmDueClockTime() - System.currentTimeMillis();
        if (initialInterval < 0) {
            setLastAlarmTime(getIntervalInSeconds() * MILLISECONDS_IN_SECOND);
        } else if (initialInterval > getIntervalInSeconds() * MILLISECONDS_IN_SECOND) {
            setLastAlarmTime(0);
        } else {
            setLastAlarmTime((getIntervalInSeconds() * MILLISECONDS_IN_SECOND) - initialInterval);
        }
    }
859296
def clear_to_reset(self, config_vars):
        

        super(ClockManagerSubsystem, self).clear_to_reset(config_vars)

        self.tick_counters = dict(fast=0, user1=0, user2=0, normal=0)

        self.is_utc = False
        self.time_offset = 0

        if self.has_rtc and self.stored_offset is not None:
            self.time_offset = self.stored_offset + self.uptime

        self.uptime = 0

        self.ticks['fast'] = config_vars.get('fast_tick', 0)
        self.ticks['user1'] = config_vars.get('user_tick_1', 0)
        self.ticks['user2'] = config_vars.get('user_tick_2', 0)
936892
private void checkAlarms(final ZonedDateTime TIME) {
        alarmsToRemove.clear();
        for (Alarm alarm : alarms) {
            final ZonedDateTime ALARM_TIME = alarm.getTime();
            switch (alarm.getRepetition()) {
                case ONCE:
                    if (TIME.isAfter(ALARM_TIME)) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                        alarmsToRemove.add(alarm);
                    }
                    break;
                case HALF_HOURLY:
                    if ((ALARM_TIME.getMinute() == TIME.getMinute() ||
                        ALARM_TIME.plusMinutes(30).getMinute() == TIME.getMinute()) &&
                        ALARM_TIME.getSecond() == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
                case HOURLY:
                    if (ALARM_TIME.getMinute() == TIME.getMinute() &&
                        ALARM_TIME.getSecond() == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
                case DAILY:
                    if (ALARM_TIME.getHour()   == TIME.getHour() &&
                        ALARM_TIME.getMinute() == TIME.getMinute() &&
                        ALARM_TIME.getSecond() == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
                case WEEKLY:
                    if (ALARM_TIME.getDayOfWeek() == TIME.getDayOfWeek() &&
                        ALARM_TIME.getHour()      == TIME.getHour() &&
                        ALARM_TIME.getMinute()    == TIME.getMinute() &&
                        ALARM_TIME.getSecond()    == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
            }
        }
        for (Alarm alarm : alarmsToRemove) {
            removeAlarm(alarm);
        }
    }
44070
def reset_alarm_ranges(self, parameter):
        
        req = mdb_pb2.ChangeParameterRequest()
        req.action = mdb_pb2.ChangeParameterRequest.RESET_ALARMS        
        
        url = '/mdb/{}/{}/parameters/{}'.format(
            self._instance, self._processor, parameter)
        response = self._client.post_proto(url, data=req.SerializeToString())
75031
public synchronized void reset() {
        this.authorizerDescription = StandardRBACAuthorizer.AUTHORIZER_DESCRIPTION;
        this.useIdentityRoles = this.nonFacadeMBeansSensitive = false;
        this.roleMappings = new HashMap<String, RoleMappingImpl>();
        RoleMaps oldRoleMaps = this.roleMaps;
        this.roleMaps = new RoleMaps(authorizerDescription.getStandardRoles(), Collections.<String, ScopedRole>emptyMap());
        for (ScopedRole role : oldRoleMaps.scopedRoles.values()) {
            for (ScopedRoleListener listener : scopedRoleListeners) {
                try {
                    listener.scopedRoleRemoved(role);
                } catch (Exception ignored) {
                    // TODO log an ERROR
                }
            }
        }
    }
169739
def save(self):
        
        # pylint: disable=bad-continuation
        args = [
            ('StartLocalTime', self.start_time.strftime(TIME_FORMAT)),
            ('Duration', '' if self.duration is None else
                self.duration.strftime(TIME_FORMAT)),
            ('Recurrence', self.recurrence),
            ('Enabled', '1' if self.enabled else '0'),
            ('RoomUUID', self.zone.uid),
            ('ProgramURI', "x-rincon-buzzer:0" if self.program_uri is None
                else self.program_uri),
            ('ProgramMetaData', self.program_metadata),
            ('PlayMode', self.play_mode),
            ('Volume', self.volume),
            ('IncludeLinkedZones', '1' if self.include_linked_zones else '0')
        ]
        if self._alarm_id is None:
            response = self.zone.alarmClock.CreateAlarm(args)
            self._alarm_id = response['AssignedID']
            Alarm._all_alarms[self._alarm_id] = self
        else:
            # The alarm has been saved before. Update it instead.
            args.insert(0, ('ID', self._alarm_id))
            self.zone.alarmClock.UpdateAlarm(args)
1230961
def set_alarm_state(self, state):
        
        values = {"desired_state": {"alarm_enabled": state}}
        response = self.api_interface.set_device_state(self, values)
        self._update_state_from_response(response)
173675
void reset(long time,
             long latest,
             AlarmListener listener,
             Object context,
             long index)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "reset",
        new Object[] { new Long(time), new Long(latest), listener, context, new Long(index) });
    
    data = listener;
    this.time = time;
    this.latest = latest;
    this.context = context;
    this.index = index;
    //check if this alarm has a group listener
    groupListener = (listener instanceof GroupAlarmListener);
    //flag as not canceled 
    active = true;
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "reset");
  }
161156
protected boolean checkLocks ()
    {
        if (_rebootLocks.isEmpty()) {
            return false;
        }

        log.info("Reboot delayed due to outstanding locks", "locks", _rebootLocks.elements());
        broadcast("m.reboot_delayed");
        (_interval = _omgr.newInterval(new Runnable() {
            public void run () {
                doWarning(getWarnings().length, 0);
            }
        })).schedule(60 * 1000);
        return true;
    }
502974
public void resumeStanzaAndPEPListeners() {
        PepManager pepManager = PepManager.getInstanceFor(connection());
        CarbonManager carbonManager = CarbonManager.getInstanceFor(connection());

        // Remove listeners to avoid them getting added twice
        connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener);
        carbonManager.removeCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
        pepManager.removePepListener(deviceListUpdateListener);

        // Add listeners
        pepManager.addPepListener(deviceListUpdateListener);
        connection().addAsyncStanzaListener(internalOmemoMessageStanzaListener, omemoMessageStanzaFilter);
        carbonManager.addCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
    }
447881
def _alarms_present(name, alarms, alarms_from_pillar, region, key, keyid, profile):
    ''''''
    current = __salt__['config.option'](alarms_from_pillar, {})
    if alarms:
        current = salt.utils.dictupdate.update(current, alarms)
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
    for _, info in six.iteritems(current):
        info["name"] = name + " " + info["name"]
        info["attributes"]["description"] = name + " " + info["attributes"]["description"]
        info["attributes"]["dimensions"] = {"LoadBalancerName": [name]}
        kwargs = {
            "name": info["name"],
            "attributes": info["attributes"],
            "region": region,
            "key": key,
            "keyid": keyid,
            "profile": profile,
        }
        # No test=False cluase needed since the state handles that itself...
        results = __states__['boto_cloudwatch_alarm.present'](**kwargs)
        if not results.get('result'):
            ret["result"] = results["result"]
        if results.get("changes", {}) != {}:
            ret["changes"][info["name"]] = results["changes"]
        if "comment" in results:
            ret["comment"] += results["comment"]
    return ret
1282343
public synchronized void restart() {
    Logcat.Listener previousListener = logcat.getListener();
    logcat.stopReading();
    logcat.interrupt();
    logcat = (Logcat) logcat.clone();
    logcat.setListener(previousListener);
    lastNotificationTime = 0;
    tracesToNotify.clear();
    logcat.start();
  }
137729
def get_devices(self, refresh=False, generic_type=None):
        """"""
        _LOGGER.info("Updating all devices...")
        if refresh or self._devices is None:
            if self._devices is None:
                self._devices = {}

            responseObject = self.get_sensors()
            if (responseObject and
                    not isinstance(responseObject, (tuple, list))):
                responseObject = responseObject

            for deviceJson in responseObject:
                # Attempt to reuse an existing device
                device = self._devices.get(deviceJson['name'])

                # No existing device, create a new one
                if device:
                    device.update(deviceJson)
                else:
                    device = newDevice(deviceJson, self)

                    if not device:
                        _LOGGER.info('Device is unknown')
                        continue

                    self._devices[device.device_id] = device

            # We will be treating the Lupusec panel itself as an armable device.
            panelJson = self.get_panel()
            _LOGGER.debug("Get the panel in get_devices: %s", panelJson)

            self._panel.update(panelJson)

            alarmDevice = self._devices.get('0')

            if alarmDevice:
                alarmDevice.update(panelJson)
            else:
                alarmDevice = ALARM.create_alarm(panelJson, self)
                self._devices['0'] = alarmDevice

            # Now we will handle the power switches
            switches = self.get_power_switches()
            _LOGGER.debug(
                'Get active the power switches in get_devices: %s', switches)

            for deviceJson in switches:
                # Attempt to reuse an existing device
                device = self._devices.get(deviceJson['name'])

                # No existing device, create a new one
                if device:
                    device.update(deviceJson)
                else:
                    device = newDevice(deviceJson, self)
                    if not device:
                        _LOGGER.info('Device is unknown')
                        continue
                    self._devices[device.device_id] = device

        if generic_type:
            devices = []
            for device in self._devices.values():
                if (device.type is not None and
                        device.type in generic_type[0]):
                    devices.append(device)
            return devices

        return list(self._devices.values())
966483
protected void scheduleReboot (long rebootTime, boolean exact, String initiator)
    {
        // if there's already a reboot scheduled, cancel it
        cancelReboot();

        long now = System.currentTimeMillis();
        rebootTime = Math.max(rebootTime, now); // don't let reboots happen in the past
        long delay = rebootTime - now;
        int[] warnings = getWarnings();
        int level = -1; // assume we're not yet warning
        for (int ii = warnings.length - 1; ii >= 0; ii--) {
            long warnTime = warnings[ii] * (60L * 1000L);
            if (delay <= warnTime) {
                level = ii;
                if (!exact) {
                    rebootTime = now + warnTime;
                }
                break;
            }
        }

        // note our new reboot time and its initiator
        _nextReboot = rebootTime;
        _initiator = initiator;

        doWarning(level, (int)((rebootTime - now) / (60L * 1000L)));
    }
796546
def reset(self):
        """"""
        if self._rst is None:
            return
        # Set reset high for a millisecond.
        self._rst.value = True
        time.sleep(0.001)
        # Set reset low for 10 milliseconds.
        self._rst.value = False
        time.sleep(0.010)
        # Set reset high again.
        self._rst.value = False
754488
public void reset() {
        listenersLock.writeLock().lock();
        try {
            for (final StatusListener listener : listeners) {
                closeSilently(listener);
            }
        } finally {
            listeners.clear();
            listenersLock.writeLock().unlock();
            // note this should certainly come after the unlock to avoid unnecessary nested locking
            clear();
        }
    }
121990
def reset(self):
        
        with self._cond:
            if self._count > 0:
                if self._state == 0:
                    #reset the barrier, waking up threads
                    self._state = -1
                elif self._state == -2:
                    #was broken, set it to reset state
                    #which clears when the last thread exits
                    self._state = -1
            else:
                self._state = 0
            self._cond.notify_all()