Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Design - to minimize cpu time

$
0
0
I have a little project where I have some web cam software that snaps a picture about every 5 minutes continually. I'd like to send some images (of those snapped between between 4 and 6 o'clock) to my googledrive folder so I can see them on my phone. It seems like the challenge is to do this economically. I've used some of the calls below. Where I'm stuck is how to make the program run all the time and then at 4 o'clock start looking for new images coming in to copy just those to the googledrive folder. I have only a 1 ghz laptop running this. I guess I would use time.sleep. My concern is that at 4 o'clock the copy command will freeze up other programs like Skype calls and some other programs I have running. Maybe it is what it is. Any ideas?






import os
import time


myfiles = os.listdir("c:\\")

xfile = "C:\\zzz.txt"
tt= os.stat(xfile ).st_ctime

tt2=  time.ctime(tt)
print tt2


create_date = os.stat(xfile)[9]
print time.strftime("%Y-%m-%d", time.gmtime(create_date))
print time.gmtime(create_date)
xx=time.gmtime(create_date)

# xx gives time.struct_time(tm_year=2011, tm_mon=3, tm_mday=28, tm_hour=3, tm_min=40, tm_sec=33, tm_wday=0, tm_yday=87, tm_isdst=0)

def get_info (xfile):
    tt= os.stat(xfile ).st_ctime

    tt2=  time.ctime(tt)
    #print tt2


    create_date = os.stat(xfile)[9]
   # print time.strftime("%Y-%m-%d", time.gmtime(create_date))

     
   # print time.gmtime(create_date)
    xx=time.gmtime(create_date)

    if xx[3] == 3:
        print xfile
        
        




    
    #print inc


for inc in range (0, len(myfiles)-90):
    director = "C:\\"
    get_info (director+  myfiles[inc])



Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>