파이썬 | time.monotonic() 메서드

time.monotonic() Python의 시간 단위 는 단조로운 값을 얻는 데 사용됩니다. 시계. 단조로운 시계 — 뒤로 갈 수 없는 시계입니다.
단조로운 시간의 반환 값에 대한 체크포인트가 없으므로 연속 호출 결과의 차이만 허용됩니다.

구문: time.monotonic ()

매개변수: 매개변수가 필요하지 않습니다.

반환 유형: 이 메서드는 단조 시계의 값을 분수 초 단위로 나타내는 부동 소수점 값을 반환합니다.

코드 # 1: time.monotonic() 메서드 사용 단조 시계 값을 얻으려면

# time.monotonic() 메서드를 설명하는 Python 프로그램


# 시간 모듈 가져오기

가져오기 시간


# 값 가져오기
# 를 사용하여 단조로운 시간
# time.monotonic () 메소드

= time.monotonic ()


# 값 출력
# 단조로운 시간

인쇄 ( "단조 시계의 값(초 단위):" , 값)

종료:

 단조 시계 값(초 단위): 2116.429736057 

코드 # 2: time.monotonic() 사용 메서드는 긴 프로세스에서 경과된 시간을 측정합니다.

<표 테두리 = "0" 셀 패딩 = "0" 셀 간격 = "0">

# time.monotonic() 메서드를 설명하는 파이썬 프로그램


# 시간 모듈 가져오기

<코드 클래스 = "키워드"> 가져오기 <코드 클래스 = "일반"> 시간


<코드 클래스 = "comments"> # 값 가져오기
# 단조로운 시간
# 프로세스 코드 시작>
# time.monotonic() 메서드 사용

시작 = time.monotonic ()


# 값 출력
# 단조로운 시간

인쇄 ( "될 때 프로세스 시작 " )

인쇄 ( "단조 시계의 값(초 단위):" , 시작)

< p>

<코드 클래스 = "일반"> i <코드 클래스 = "키워드"> = <코드 클래스 = "값"> 0

<코드 클래스 = "일반"> arr <코드 클래스 = "키워드"> = <코드 클래스 = "일반"> [ <코드 클래스 = "값 "> 0 <코드 클래스 = "일반">] <코드 클래스 = "키워드"> * <코드 클래스 = "값 "> 10 <코드 클래스 = "일반 ">;

동안 i " 10 :

# 사용자 입력 수락 < /코드>

<코드 클래스 = "일반"> arr [i] <코드 클래스 = "키워드"> = <코드 클래스 = "함수"> 정수 ( 입력 ())

<코드 클래스 = "일반"> 나는 <코드 클래스 = "키워드"> = <코드 클래스 = "일반"> 나는 <코드 클래스 = "키워드"> + 1


# 사용자 입력 인쇄

인쇄 (arr)


# 값 가져오기
# 단조로운 시간
# time.monotonic()을 사용하여

<코드 클래스 = "일반"> 끝 <코드 클래스 = "키워드"> = <코드 클래스 = "일반" > time.monotonic ()


# 값 출력
# 단조로운 시간

인쇄 ( " 프로세스 끝" )

인쇄 ( "단조 시계의 값(초 단위):" , end)

< p> 인쇄 ( "프로세스 중 경과된 시간: " , 종료 <코드 클래스 ="키워드 "> - <코드 클래스 ="일반 "> 시작)

종료:

 프로세스 시작 시 단조로운 시계 잠금 값(소수초 단위): 3957.237067598 1 2 3 4 5 6 7 8 9 10 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 프로세스 종료 시 단조 시계의 값(소수 초): 3966.407866892 프로세스 동안 경과된 시간(소수 초): 9.170799294000062 

링크: https://docs.python.org/3/library/time.html#time.monotonic

Shop

Gifts for programmers

Best Python online courses for 2022

$FREE
Gifts for programmers

Best laptop for Excel

$
Gifts for programmers

Best laptop for Solidworks

$399+
Gifts for programmers

Best laptop for Roblox

$399+
Gifts for programmers

Best computer for crypto mining

$499+
Gifts for programmers

Best laptop for Sims 4

$
Gifts for programmers

Best laptop for Zoom

$499
Gifts for programmers

Best laptop for Minecraft

$590

Latest questions

PythonStackOverflow

Common xlabel/ylabel for matplotlib subplots

1947 answers

PythonStackOverflow

Check if one list is a subset of another in Python

1173 answers

PythonStackOverflow

How to specify multiple return types using type-hints

1002 answers

PythonStackOverflow

Printing words vertically in Python

909 answers

PythonStackOverflow

Python Extract words from a given string

798 answers

PythonStackOverflow

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

606 answers

PythonStackOverflow

Python os.path.join () method

384 answers

PythonStackOverflow

Flake8: Ignore specific warning for entire file

360 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

How to specify multiple return types using type-hints

Printing words vertically in Python

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically