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


Python Delorean.time方法代码示例

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


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

示例1: test_time_timtravel

# 需要导入模块: from delorean import Delorean [as 别名]
# 或者: from delorean.Delorean import time [as 别名]
 def test_time_timtravel(self, seconds=1, minutes=1, microseconds=100):
     d = Delorean()
     sample = datetime(2011, 10, 10, 1, 33, 4, 121940)
     d.utcdatetime = sample
     current_time = d.datetime()
     current_time = current_time + timedelta(seconds=1, minutes=1, microseconds=100)
     d.timetravel(seconds=1, minutes=1, microseconds=100)
     self.assertEqual(d.time(), current_time.time())
开发者ID:sshamte,项目名称:delorean,代码行数:10,代码来源:test_delorean.py

示例2:

# 需要导入模块: from delorean import Delorean [as 别名]
# 或者: from delorean.Delorean import time [as 别名]
        # Check each day until we hit the day that is today, in the
        # user's timezone.
        for range in schedule.ranges:
            if range.day is not None and range.day.name == day_names[day]:

                # Print out today's users who have hours, as an aid.
                print "%s\t%s\t%s" % (luser.profile[0].username,
                                      range.start_time,
                                      range.end_time)

                
                # Only notify within the first 15 minutes of the hour after.
                # This will allow us to use the flow of time to avoid 
                # duplicating notifications.
                time_now = now.time()
               

                end_time_in_minutes = range.end_time.hour * 60 + range.end_time.minute
                now_in_minutes = time_now.hour * 60 + time_now.minute

                # If it is within 15 minutes after an hour has passed,
                # send the reminder email
                if end_time_in_minutes + 60 < now_in_minutes and \
                    now_in_minutes < end_time_in_minutes + 75:

                    # send the email.
                    mailer.send(from_addr=MAIL_FROM, to_addr=luser.email,
                                subject="Reminder: Please report in on %s" % \
                                schedule.project.name,
                                text=message % \
开发者ID:roeske,项目名称:codecolab,代码行数:32,代码来源:remind_user_to_report.py


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