# Time Stamping in Python

I have written a script that allows me to time stamp my work during the day. I am sharing it with MIT license  here

I am mostly interested in having my timed activity saved in a csv file that will help me organize my time of the day. The script outputs a csv file with information about the date, time in which work has started, time in which work has ended, time difference of the two and the total time used for the day . So if you timed on for a day and then timed off at another day, then the script will detect it and ask you to give a time when you stopped your work in the day before. It is really merely to record my activity during that day and nothing more.  The script is text-based and if you run it, it will ask if you want to stamp time on or off. If you chose on and then the next time you run it (with the same data file) and ask to time off then it will accordingly do the computation and append the data file. If you chose time on (or time off) two consecutive time, then the script will ask you to first time off (resp. time on) your previous activity.  To run the script, I just place it in my common python library path (I only use Python 2.5 but I guess this would work for any newer version) and then I have a specific script that applied this script as a module in a folder where I have my specific activity. For instance if I have a folder in my PC where I often do my mathematical work, I place a python script with this content in it:

from time_stamp import timestamp
timestamp('./etc/math_timestamp.csv')


where the file ./etc/math_timestamp.csv is the relative filename from the place where the python script is located and where you want your data file (in this case math_timestamp.csv) to be saved. The data file is automatically created if it does not exist (only the directory should exist). Data file should not be tampered with, though it can be opened with any editor that understands csv (or a simple text editor). This allows me to time stamp fragmented  parts of my work while keeping my discipline and track for the amount of work I put for a specific task. For instance, I often would like to do 2 hours of math, 2 hours of chess and a few hours of other work and I use different data files for them (I don’t complete the 2 hours in one go). It definitely has kept me disciplined in the past few months and I have achieved more milestones by it. Simple but effective and yet not so sophisticated like a full fledged UI or something. That’s the way a minimalist like me wants it!