Beispiel #1
0
def menuCallbackAutoTimer(self, ret):
    ret = ret and ret[1]
    if ret:
        if ret == "add":
            from AutoTimerEditor import addAutotimerFromEvent
            cur = self["list"].getCurrent()
            evt = cur[0]
            sref = cur[1]
            if not evt:
                return
            try:
                addAutotimerFromEvent(self.session, evt=evt, service=sref)
            except:
                pass
        elif ret == "preview":
            from AutoTimerPreview import AutoTimerPreview
            try:
                if not autotimer.getStatusParseEPGrunning():
                    total, new, modified, timers, conflicts, similars = autotimer.parseEPG(
                        simulateOnly=True)
                    self.session.open(AutoTimerPreview, timers)
            except:
                pass
        elif ret == "search":
            try:
                if not autotimer.getStatusParseEPGrunning():
                    editCallback(self.session)
            except:
                pass
        elif ret == "timerlist":
            try:
                from Screens.TimerEdit import TimerEditList
                self.session.open(TimerEditList)
            except:
                pass
        elif ret == "openplugin":
            try:
                main(self.session)
            except:
                pass
        elif ret == "input":
            try:
                from time import time as my_time
                global mepg_config_initialized
                if not mepg_config_initialized:
                    config.misc.prev_mepg_time = ConfigClock(default=my_time())
                    mepg_config_initialized = True
                self.session.openWithCallback(self.onDateTimeInputClosed,
                                              TimeDateInput,
                                              config.misc.prev_mepg_time)
            except:
                pass
Beispiel #2
0
def menuCallbackAutoTimer(self, ret):
    ret = ret and ret[1]
    if ret:
        if ret == "add":
            from AutoTimerEditor import addAutotimerFromEvent

            cur = self["list"].getCurrent()
            evt = cur[0]
            sref = cur[1]
            if not evt:
                return
            try:
                addAutotimerFromEvent(self.session, evt=evt, service=sref)
            except:
                pass
        elif ret == "preview":
            from AutoTimerPreview import AutoTimerPreview

            try:
                total, new, modified, timers, conflicts, similars = autotimer.parseEPG(simulateOnly=True)
                self.session.open(AutoTimerPreview, timers)
            except:
                pass
        elif ret == "search":
            try:
                editCallback(self.session)
            except:
                pass
        elif ret == "timerlist":
            try:
                from Screens.TimerEdit import TimerEditList

                self.session.open(TimerEditList)
            except:
                pass
        elif ret == "openplugin":
            try:
                main(self.session)
            except:
                pass
        elif ret == "input":
            try:
                from time import time as my_time

                global mepg_config_initialized
                if not mepg_config_initialized:
                    config.misc.prev_mepg_time = ConfigClock(default=my_time())
                    mepg_config_initialized = True
                self.session.openWithCallback(self.onDateTimeInputClosed, TimeDateInput, config.misc.prev_mepg_time)
            except:
                pass
_author_ = "aman"
import time
import random
from time import time as my_time

input("Hit enter to start")
wait_time = random.randint(1, 5)
time.sleep(wait_time)
start_time = my_time()
input("Hit enter to stop")
end_time = my_time()

print("Start time " + time.strftime("%X", time.localtime(start_time)))
print("End time " + time.strftime("%X", time.localtime(end_time)))

print("Reaction time is {}".format(end_time - start_time))
Beispiel #4
0
"""
Write a small program to display information on the four clocks
 whose functions we have just looked at:
i.e. time(), perf_counter(), monotonic() and process_time().

Use the documentation for the get_clock_info() function
to work out how to call it for each of the clocks.
"""
import time
from time import localtime as local_time
from time import perf_counter as performance_count
from time import process_time as processor_time
from time import time as my_time

print(processor_time(), "--> process time")
print(performance_count(), "--> performance time")
print(my_time(), "Your machine local time")
time_lapce = local_time()
print("Year:", time_lapce[0], "  Month:", time_lapce[1], "  Day:",
      time_lapce[2], "  Hour:", time_lapce[3], "Minute:", time_lapce[4])

print("process()" + "\t", time.get_clock_info('process_time'))