A key principle in productivity is that if you don’t take control of your time, someone else will take control of it for you.
Every endeavour in self improvement requires establishing a habit, and a key part of that habit is allocating time to focus on that habit above all else. Considering a regular workout routine, or a habit of reading daily. To get these habits to stick, you first have to be the master of your time, and master is the correct word here. You need to be ruthless, and make sure everyone around you understands it is your time, and it is more valuable. Don’t let them make you feel guilty for it. When its all said done, what are the chances you’ll regret not clocking in more time for someone else? Remember, its an investment in your life, and interestingly, by ruthless in your time, you can come out of it all, more able to help those around you, because you put yourself first.
I find one way to make this stick is to remember the safety advice when you get on a flight:
“Fit your oxygen mask before helping others.”
Look after yourself first, so you can help others later.
MySQL comes with two handy functions for working with unix timestamps. The unix timestamp or unix epoch time represents the number of seconds since midnight (UTC) 01/01/1970.
The two functions are:
unix_timestamp() to convert a standard date to unix timestamp format
from_unixtime() to convert a unix timestamp to standard date format
Note if you want the current date only (not time) in unix format use:
If you want the current date AND local time in unix format use:
A time audit is a review of how you spend your day with the goal of identifying where you might be wasting time, or otherwise not being as productive as you would like to be.
There’s a good article about how to perform a Time Audit at Productivity501.
My previous post on RescueTime is a good place to start to see what you do on your PC (assuming it is where you spend a lot of your time).
A few tips on the process:
- The first step is to figure out what is important to you. What do you want to be spending your time on? If you can’t answer that, then stop and figure that stuff out first. You know, the usual goal setting, evaluating your life etc.
- Spend some time, just collecting data. Don’t try to adjust your routine too much. Some things will be obvious (and areas where you can change) but, its nice to have a baseline to know how things were when you started.
- Once you have adequate data, address ONE thing at a time. As suggested in the article, one of the first things to look at is simply the order in which you approach things each day. Perhaps the most fundamental change I made, was to make sure I work on what I consider to be the most important thing first thing in the morning before, I do anything else.
- Review how much time you spend creating (e.g. writing code) vs consuming (reading blogs). Make sure you aren’t spending too much time consuming.
- Batch things together. If there are a number of related things you do during the day, can you do them all in one hit?
- Apply Pareto principle (80-20 rule) to your day. Are you spending 80% of your time on the 20% of things that create 80% of the value?
- Do you do one thing at at a time? Or do you jump around through the day? One of the biggest (but often hidden) ways to waste time is to be constantly context-switching.
Remember, a time audit is an operational step in your “productivity”. It is purely to see where you might be losing time in your day that you can reclaim. It helps once, you have got your stuff together and know exactly why it is you need more time in your day, and what you plan to do with that recovered time.
Perhaps unexpected, the time command, doesn’t actually give you the system time (use date for that). What it is does is “time” how long something takes to run (so a different use of the word time).
So for example, let’s say you are doing a mysql import, you can prepend it with time to find how long it took to run:
$ time mysql -u user -p db < import_file.sql
A quick and useful benchmark, even if it only lets you know how long you have to go make a coffee 🙂
Another really useful linux command is test, which can be used to test if a file exists and then rename it.
Here’s an example:
$ test -f test.txt && mv test.txt test.txt.`date +%Y%m%d-%H%M%S`
This first tests if the file test.txt exists. If it does, it renames the file test.txt.YYYMMDD-HHMMSS (appropriate date/time stamp). Great for scripts that are working with a log file and need to rename it before starting a new log.
I often find myself needing to append a date (and sometimes a time stamp) to files.
The following will generate the current date in the format YYYYMMDD which is the most suitable for sorting files.
$ date +%Y%m%d
Example output is “20120528” or Year = 2012, Month=05 (May) and day = 28.
Similarly the following will output the current time in the format HH24MMSS (24 hour time)
Example output is “193347” or Hour = 19, Minute = 33 and second = 47 (19:33.47).
The two can be combined:
Example output is 20120528-193347. Note the separation of the date and time with a dash.
You can use these commands in your shell scripts. For example, this will create an empty test file called “Test.txt.20120528-193347”:
$ touch Test.txt.`date +%Y%m%d-%H%M%S`
As you can see, quite handy for organising files.