当前位置: 首页>>代码示例>>Python>>正文


Python Time.fromPOSIXTimestamp方法代码示例

本文整理汇总了Python中epsilon.extime.Time.fromPOSIXTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Python Time.fromPOSIXTimestamp方法的具体用法?Python Time.fromPOSIXTimestamp怎么用?Python Time.fromPOSIXTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在epsilon.extime.Time的用法示例。


在下文中一共展示了Time.fromPOSIXTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testScheduleWithEarlierTimedEvents

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def testScheduleWithEarlierTimedEvents(self):
        """
        Like L{testSchedule}, but use a SubScheduler which has pre-existing
        TimedEvents which are before the new runnable's scheduled time.
        """
        now = self.clock.seconds()
        when = Time.fromPOSIXTimestamp(now + 15)
        null = NullRunnable(store=self.substore)
        self.subscheduler.schedule(null, when)
        runnable = self._scheduleRunner(now, 10)

        self.clock.advance(11)

        self.assertEqual(
            list(self.subscheduler.scheduledTimes(runnable)),
            [Time.fromPOSIXTimestamp(now + 20)])

        self.assertEqual(
            list(self.subscheduler.scheduledTimes(null)),
            [Time.fromPOSIXTimestamp(now + 15)])

        hook = self.store.findUnique(
            _SubSchedulerParentHook,
            _SubSchedulerParentHook.subStore == self.substoreItem)

        self.assertEqual(
            list(self.scheduler.scheduledTimes(hook)),
            [Time.fromPOSIXTimestamp(now + 15)])
开发者ID:ldanielburr,项目名称:axiom,代码行数:30,代码来源:test_scheduler.py

示例2: _testSchedule

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def _testSchedule(self, scheduler):
     t1 = TestEvent(store=scheduler.store)
     scheduler.schedule(t1, Time.fromPOSIXTimestamp(0))
     self.failIf(self.calls,
                 "Should not have had any calls: %r" % (self.calls,))
     self.assertIdentical(
         scheduler._getNextEvent(Time.fromPOSIXTimestamp(1)).runnable, t1)
开发者ID:ldanielburr,项目名称:axiom,代码行数:9,代码来源:test_scheduler.py

示例3: setUp

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def setUp(self):
        self.clock = Clock()

        self.dbdir = filepath.FilePath(self.mktemp())
        self.store = Store(self.dbdir)
        self.substoreItem = SubStore.createNew(self.store, ['sub'])
        self.substore = self.substoreItem.open()

        self.scheduler = IScheduler(self.store)
        self.subscheduler = IScheduler(self.substore)

        self.scheduler.callLater = self.clock.callLater
        self.scheduler.now = lambda: Time.fromPOSIXTimestamp(self.clock.seconds())
        self.subscheduler.now = lambda: Time.fromPOSIXTimestamp(self.clock.seconds())

        IService(self.store).startService()
开发者ID:ldanielburr,项目名称:axiom,代码行数:18,代码来源:test_scheduler.py

示例4: _setUpMsg

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def _setUpMsg(self):
        """
        Install an innocuous incoming message in a newly-created store

        @rtype: L{xquotient.exmess.Message}
        """
        s = self._setUpStore()

        m = Message.createIncoming(s, _Part(store=s), u'test://test')
        m.subject = u'the subject'
        m.sender = u'[email protected]'
        m.senderDisplay = u'Sender'
        m.recipient = u'[email protected]'
        m.sentWhen = Time.fromPOSIXTimestamp(0)
        m.receivedWhen = Time.fromPOSIXTimestamp(1)
        m.classifyClean()
        return m
开发者ID:pombredanne,项目名称:quotient,代码行数:19,代码来源:livetest_msgdetail.py

示例5: testSchedule

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def testSchedule(self):
        """
        Test the schedule method, as invoked from the run method of an item
        being run by the subscheduler.
        """
        now = self.clock.seconds()
        runnable = self._scheduleRunner(now, 10)

        self.clock.advance(11)

        self.assertEqual(
            list(self.subscheduler.scheduledTimes(runnable)),
            [Time.fromPOSIXTimestamp(now + 20)])

        hook = self.store.findUnique(
            _SubSchedulerParentHook,
            _SubSchedulerParentHook.subStore == self.substoreItem)

        self.assertEqual(
            list(self.scheduler.scheduledTimes(hook)),
            [Time.fromPOSIXTimestamp(now + 20)])
开发者ID:ldanielburr,项目名称:axiom,代码行数:23,代码来源:test_scheduler.py

示例6: test_now

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def test_now(self):
        """
        The user store's L{IScheduler} powerup's C{now} method returns whatever
        the site store's L{IScheduler} powerup's C{now} method returns.
        """
        # I don't want the stubbed now method.
        del self.scheduler.now

        self.clock.advance(17)
        self.assertEquals(
            self.scheduler.now(),
            Time.fromPOSIXTimestamp(self.clock.seconds()))
开发者ID:ldanielburr,项目名称:axiom,代码行数:14,代码来源:test_scheduler.py

示例7: setMetadata

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def setMetadata(self, meta):
     """
     Set the topic in the database
     """
     self.channelItem.topic = unicode(meta['topic'])
     self.channelItem.topicAuthor = unicode(meta['topic_author'])
     self.channelItem.topicTime = Time.fromPOSIXTimestamp(meta['topic_date'])
     sets = []
     for p in self.users.itervalues():
         d = defer.maybeDeferred(p.groupMetaUpdate, self, meta)
         d.addErrback(self._ebUserCall, p=p)
         sets.append(d)
     defer.DeferredList(sets).addCallback(self._cbUserCall)
     return defer.succeed(None)
开发者ID:corydodt,项目名称:Vellum,代码行数:16,代码来源:ircserver.py

示例8: test_blurbTimestampColumn

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def test_blurbTimestampColumn(self):
     """
     Verify the L{xmantissa.ixmantissa.IColumn} implementation of
     L{hyperbola_view._BlurbTimestampColumn}.
     """
     col = hyperbola_view._BlurbTimestampColumn()
     self.assertEqual(col.attributeID, 'dateCreated')
     self.assertEqual(col.getType(), 'timestamp')
     self.blogPostItem.dateCreated = Time.fromPOSIXTimestamp(345)
     value = col.extractValue(None, self.blogPostItem)
     self.assertEqual(value, 345)
     self.assertIdentical(col.sortAttribute(), hyperblurb.Blurb.dateCreated)
     comparable = col.toComparableValue(345)
     self.assertEqual(comparable, self.blogPostItem.dateCreated)
开发者ID:pombredanne,项目名称:hyperbola,代码行数:16,代码来源:test_view.py

示例9: testMultipleEventsPerTick

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def testMultipleEventsPerTick(self):
        """
        Test running several runnables in a single tick of the subscheduler.
        """
        now = self.clock.seconds()
        runnables = [
            self._scheduleRunner(now, 10),
            self._scheduleRunner(now, 11),
            self._scheduleRunner(now, 12)]

        self.clock.advance(13)

        for n, runnable in enumerate(runnables):
            self.assertEqual(
                list(self.subscheduler.scheduledTimes(runnable)),
                [Time.fromPOSIXTimestamp(now + n + 20)])

        hook = self.store.findUnique(
            _SubSchedulerParentHook,
            _SubSchedulerParentHook.subStore == self.substoreItem)

        self.assertEqual(
            list(self.scheduler.scheduledTimes(hook)),
            [Time.fromPOSIXTimestamp(now + 20)])
开发者ID:ldanielburr,项目名称:axiom,代码行数:26,代码来源:test_scheduler.py

示例10: _makeMessages

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
    def _makeMessages(self):
        """
        Make 3 incoming messages

        @rtype: C{list} of L{xquotient.exmess.Message}
        """
        msgs = []
        for (subject, timestamp) in ((u'3', 67), (u'1', 43), (u'2', 55)):
            msgs.append(
                testMessageFactory(
                    store=self.store,
                    read=False,
                    spam=False,
                    subject=subject,
                    receivedWhen=Time.fromPOSIXTimestamp(timestamp)))
        return msgs
开发者ID:pombredanne,项目名称:quotient,代码行数:18,代码来源:test_inbox.py

示例11: outfilter

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def outfilter(self, dbval, oself):
     if dbval is None:
         return None
     return Time.fromPOSIXTimestamp(dbval / MICRO)
开发者ID:bne,项目名称:squeal,代码行数:6,代码来源:attributes.py

示例12: toComparableValue

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def toComparableValue(self, value):
     """
     Convert a float from the client back into a timestamp.
     """
     return Time.fromPOSIXTimestamp(value)
开发者ID:pombredanne,项目名称:hyperbola,代码行数:7,代码来源:hyperbola_view.py

示例13: registerAddress

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def registerAddress(self, physicalURL, expiryTime):
     self.physicalURL = physicalURL.toString()
     self.expiryTime = Time.fromPOSIXTimestamp(time.time() + expiryTime)
     return [(physicalURL, self.expiryTime)]
开发者ID:habnabit,项目名称:divmod-sine,代码行数:6,代码来源:sipserver.py

示例14: _scheduleRunner

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def _scheduleRunner(self, now, offset):
     scheduledAt = Time.fromPOSIXTimestamp(now + offset)
     rescheduleFor = Time.fromPOSIXTimestamp(now + offset + 10)
     runnable = ScheduleCallingItem(store=self.substore, rescheduleFor=rescheduleFor)
     self.subscheduler.schedule(runnable, scheduledAt)
     return runnable
开发者ID:ldanielburr,项目名称:axiom,代码行数:8,代码来源:test_scheduler.py

示例15: toComparableValue

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
 def toComparableValue(self, value):
     """
     Override L{AttributeColumn}'s implementation to return a L{Time} instance.
     """
     return Time.fromPOSIXTimestamp(value)
开发者ID:fusionapp,项目名称:mantissa,代码行数:7,代码来源:scrolltable.py


注:本文中的epsilon.extime.Time.fromPOSIXTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。