Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(6)  |  Derive(0)  |  Import(4)
Given a time_t 'when', return the smallest time_t > when that falls
on midnight, GMT.

        def succeedingMidnight(when):
    """Given a time_t 'when', return the smallest time_t > when that falls
       on midnight, GMT."""
    yyyy,MM,dd = time.gmtime(when)[0:3]
    try:
        return calendar.timegm((yyyy,MM,dd+1,0,0,0,0,0,0))
    except ValueError:
        # Python 2.3 seems to raise ValueError when dd is the last day of the
        # month.
        pass
    if MM < 12:
        return calendar.timegm((yyyy,MM+1,1,0,0,0,0,0,0))
    else:
        return calendar.timegm((yyyy+1,1,1,0,0,0,0,0,0))
        


src/m/i/mixminion-HEAD/lib/mixminion/server/Pinger.py   mixminion(Download)
import mixminion.server.MMTPServer
 
from mixminion.Common import MixError, AtomicFile, ceilDiv, createPrivateDir, \
     floorDiv, formatBase64, formatFnameDate, formatTime, IntervalSet, LOG, \
     parseFnameDate, previousMidnight, readPickled, secureDelete, \
    def getIntervalContaining(self, t):
        """Return a 2-tuple of the start and the end of the interval containing
           't'.  The bottom of the interval is closed; the top is open."""
        p = previousMidnight(t)
        return p, succeedingMidnight(p)
        t = previousMidnight(startAt)
        while t < endAt:
            n = succeedingMidnight(t)
            r.append((t, n))
            t = n

src/m/i/mixminion-HEAD/lib/mixminion/server/ServerMain.py   mixminion(Download)
 
from bisect import insort
from mixminion.Common import LOG, LogStream, MixError, MixFatalError,\
     UIError, ceilDiv, createPrivateDir, disp64, formatTime, \
     installSIGCHLDHandler, Lockfile, LockfileLocked, readFile, secureDelete, \
    def updateDirectoryClient(self, reschedulePings=1):
        try:
            self.dirClient.update()
            nextUpdate = succeedingMidnight(time.time()+30)
            prng = mixminion.Crypto.getCommonPRNG()
            LOG.warn(str(e))
            LOG.warn("    I'll try again in an hour.")
            nextUpdate = min(succeedingMidnight(time.time()+30),
                             time.time()+3600)
            reschedulePings = 0
        except UIError, e:#XXXX008 This should really be a new exception
            LOG.warn(str(e))
            LOG.warn("    I'll try again in an hour.")
            nextUpdate = min(succeedingMidnight(time.time()+30),

src/m/i/mixminion-HEAD/lib/mixminion/ClientMain.py   mixminion(Download)
import mixminion.MMTPClient
 
from mixminion.Common import LOG, Lockfile, LockfileLocked, MixError, \
     MixFatalError, MixProtocolBadAuth, MixProtocolError, STATUS, UIError, \
     UsageError, createPrivateDir, englishSequence, floorDiv, formatTime, \

src/m/i/mixminion-HEAD/lib/mixminion/ClientUtils.py   mixminion(Download)
import mixminion.Packet
 
from mixminion.Common import LOG, MixError, UIError, ceilDiv, \
     createPrivateDir, floorDiv, previousMidnight, readFile, \
     succeedingMidnight, writeFile, armorText, unarmorText, MixFatalError
    def newSURBKey(self, identity, expiresAt, secretLen):
        """See ClientUtils.Keyring.newSURBKey"""
        assert '\0' not in identity
        identity = identity.lower()
        expires = succeedingMidnight(expiresAt)