ответвлено от main/python-labs
remew
Этот коммит содержится в:
@@ -15,20 +15,16 @@ import time
|
||||
import random
|
||||
import cmath
|
||||
|
||||
# 1. Московское время + 3 часа и перевод в секунды
|
||||
# Получаем текущее время в секундах от начала эпохи (UTC)
|
||||
# Получаем текущее время в секундах от начала эпохи (MSC)
|
||||
current_seconds = time.time()
|
||||
|
||||
# Московское время = UTC + 3 часа
|
||||
moscow_seconds = current_seconds + (3*60*60)
|
||||
|
||||
# Преобразуем в читаемый формат с помощью gmtime
|
||||
moscow_time = time.strftime('%d.%m.%Y %H:%M:%S', time.gmtime(moscow_seconds))
|
||||
moscow_time = time.ctime(current_seconds)
|
||||
print(f"Текущее Московское время: {moscow_time}")
|
||||
|
||||
# Добавляем еще 3 часа
|
||||
new_seconds = moscow_seconds + (3*60*60)
|
||||
new_time = time.strftime('%d.%m.%Y %H:%M:%S', time.gmtime(new_seconds))
|
||||
new_seconds = current_seconds + (3*60*60)
|
||||
new_time = time.ctime(new_seconds)
|
||||
|
||||
print(f"Московское время + 3 часа: {new_time}")
|
||||
print(f"Число секунд = {int(new_seconds)}")
|
||||
|
||||
@@ -6,16 +6,13 @@ import cmath
|
||||
# Получаем текущее время в секундах от начала эпохи (UTC)
|
||||
current_seconds = time.time()
|
||||
|
||||
# Московское время = UTC + 3 часа
|
||||
moscow_seconds = current_seconds + (3*60*60)
|
||||
|
||||
# Преобразуем в читаемый формат с помощью gmtime
|
||||
moscow_time = time.strftime('%d.%m.%Y %H:%M:%S', time.gmtime(moscow_seconds))
|
||||
moscow_time = time.ctime(current_seconds)
|
||||
print(f"Текущее Московское время: {moscow_time}")
|
||||
|
||||
# Добавляем еще 3 часа
|
||||
new_seconds = moscow_seconds + (3*60*60)
|
||||
new_time = time.strftime('%d.%m.%Y %H:%M:%S', time.gmtime(new_seconds))
|
||||
new_seconds = current_seconds + (3*60*60)
|
||||
new_time = time.ctime(new_seconds)
|
||||
|
||||
print(f"Московское время + 3 часа: {new_time}")
|
||||
print(f"Число секунд = {int(new_seconds)}")
|
||||
|
||||
Ссылка в новой задаче
Block a user