2012-08-01 21:00:25 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2012-08-01 21:54:19 +00:00
|
|
|
import argparse
|
2012-08-01 21:00:25 +00:00
|
|
|
import calendar
|
|
|
|
import datetime
|
|
|
|
|
2012-08-01 21:54:19 +00:00
|
|
|
import signal
|
|
|
|
|
2012-08-01 21:00:25 +00:00
|
|
|
import locale
|
2012-08-01 21:54:19 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import sys
|
2012-08-01 21:00:25 +00:00
|
|
|
|
2012-08-01 21:54:19 +00:00
|
|
|
#def user_datetime(when):
|
|
|
|
# """Print time for the user"""
|
|
|
|
# return when.ctime()
|
2012-08-01 21:00:25 +00:00
|
|
|
|
2012-08-01 21:54:19 +00:00
|
|
|
|
|
|
|
# Setup locale for calendar printing
|
|
|
|
# Setup locale to get Timezone information?
|
2012-08-01 21:00:25 +00:00
|
|
|
print(locale.getlocale())
|
2012-08-01 21:54:19 +00:00
|
|
|
|
|
|
|
# Record project
|
|
|
|
# Record tags
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("project_name", nargs=1)
|
|
|
|
|
|
|
|
args = parser.parse_args(sys.argv[1:])
|
|
|
|
|
|
|
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
# Setup signal handler
|
|
|
|
|
|
|
|
# Start tracking
|
|
|
|
start = datetime.datetime.now()
|
|
|
|
print("Starting at %s" % (start.ctime()))
|
|
|
|
|
|
|
|
time.sleep(2)
|
|
|
|
|
|
|
|
# Stop tracking
|
|
|
|
stop = datetime.datetime.now()
|
|
|
|
print("Stopped at %s" % (stop.ctime()))
|
|
|
|
|
|
|
|
delta = stop - start
|
|
|
|
print("%s, %s, seconds=%s, %s" % (type(delta), delta, delta.total_seconds(), start.strftime("%s")))
|
|
|
|
|
|
|
|
# Save stuff to our home directory
|
|
|
|
|
|
|
|
# Prepare home directory
|
|
|
|
home = os.environ['HOME']
|
|
|
|
ctt_home = home + os.path.join(home, ".ctt")
|
|
|
|
os.makedirs(ctt_home, mode=0o700, exist_ok=True)
|
|
|
|
|
|
|
|
# Create datetime from userinput
|
|
|
|
# Wed Aug 1 23:35:53 2012
|