P
P
Petr Kolesnikov2021-03-13 14:02:36
Python
Petr Kolesnikov, 2021-03-13 14:02:36

When the clock moves from 22:59 to 23:00, the smaller one is subtracted from the larger one, how to fix this?

def showtime(instance):
    global currentline
    global timepassed
    global time1111
    time1 = datetime.datetime.now()
    time11 = time1.strftime('%H:%M')
    time111 = str(time11)
    time1111 = time111.replace(":", "")
 
    currentline = BoxLayout()
    timestart = IncrediblyCrudeClock()
    start_time = time.time()
    Clock.schedule_once(timestart.update)
    currentline.add_widget(timestart)
    event()
    layout.remove_widget(instance)
    layout.add_widget(button_stop)
    layout.add_widget(currentline)
 
 
def hidetime(instance):
 
    global timepassed
    global start_time
    global time1111
    time2 = datetime.datetime.now()
    time22 = time2.strftime("%H:%M")
    time222 = str(time22)
    time2222 = time222.replace(":", "")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Trushin, 2021-03-13
@PirraToZ

def one_f():#КОНЕЦ ПОКАЗА ВРЕМЕНИ
    global time4
    global time2
    time4 = time.time()
    time2 = str(time.ctime(time4).split()[3][:5])
    min_start = time1.replace(":", " ").split()
    min_end = time2.replace(":", " ").split()
    if min_end[1] == '00' and min_start == '00':
        timepassed = 0
    elif min_end[1] == '00':
        timepassed = int(60 - int(min_start[1]))
    elif int(min_end[1]) < int(min_start[1]):
        timepassed = 60 - int(min_start[1]) + int(min_end[1])
    else:
        timepassed = int(min_end[1]) - int(min_start[1])

def two_f():#НАЧАЛО ПОКАЗА ВРЕМЕНИ
    global time3
    global time1
    time3 = time.time()
    time1 = str(time.ctime(time3).split()[3][:5])

Mark the issue as solved, thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question