-
Notifications
You must be signed in to change notification settings - Fork 0
/
ISR_seconds.py
17 lines (14 loc) · 915 Bytes
/
ISR_seconds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import time #Importing 'time' library
import datetime #Importing 'datetime' library
from datetime import timedelta #Importing 'timedelta' class from library
t1 = datetime.datetime.now().time() #accessing current system time
print t1
#"""
print "seconds = ",t1.second #printing seconds value of current time
count1 = 1 #Initializing count variable
while (count1 <= 10): #Loop for 10 iterations
current_second = datetime.datetime.now().time().second
if(current_second == (t1.second + count1)): #check & compare current seconds value
print "printing at ", current_second , " seconds" #Print every second
count1 = count1 + 1 #Increment count
#"""