Skip to content

Instantly share code, notes, and snippets.

@soren
Last active December 18, 2018 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soren/187009d0e2031e8c2ef4adb5d8fbe45c to your computer and use it in GitHub Desktop.
Save soren/187009d0e2031e8c2ef4adb5d8fbe45c to your computer and use it in GitHub Desktop.

NAME

timeclock.pl - a timeclock reporting utility

SYNOPSIS

timeclock.pl [--html|--csv] [file]

timeclock.pl [--help|--man|--version]

Some examples:

# Console output
$ timeclock.pl timelog.bak

# HTML output
$ timeclock.pl --html > report.html

# CSV output
$ timeclock.pl --csv > report.csv

ARGUMENTS

If you run timeclock.pl without any arguments, it will read a timelog file from one of the default locations (either ~/.emacs.d/timelog or ~/.timelog) and print an ASCII formatted daily report to the console.

If your timelog file is located somewhere else, timeclock.pl can be called with the name of a timelog file to read.

Whether you specify a file or not, you can change the default output format by adding on of the following arguments:

--html

Switches to HTML formatted output.

--csv

Switches to CSV formatted output.

timeclock.pl can also print version an usage information. This is done by specifying exactly one argument that should be one of the following:

--help

Print short usages information and exits.

--man

Displays the manual and exits.

--version

Displays the version number and copyright information and exits.

DESCRIPTION

This is a simple reporting utility for timeclock, which is a time tracking package for GNU Emacs.

You will use timeclock from GNU Emacs to check in and check out of projects during your workday.

Then at the end of the week you can run timeclock.pl to get a daily report of your work time.

CONFIGURATION

If you haven't changed your Emacs/TimeClock setup, no configuration is needed. The script will read your timelog file from the default location which is either ~/.emacs.d/timlog or ~/.timelog depending on your Emacs version.

If you have changed the location of the timelog file (I've placed mine in a MEGA folder), you can create the file ~/.timeclockrc and define the location of the timelog file there. Example:

$timelog = "$ENV{HOME}/MEGA/timelog";

Emacs Integration

You could add the following to you .emacs file to integrate timeclock.pl into Emacs:

(defun timeclock-show-daily-report()
  "Creates and displays a daily report of tim<eclock entries."
  (interactive)
  (let ((process-connection-type nil)   ; Use a pipe.
        (command-name "timeclock")
        (buffer-name "*timeclock daily report*")
        (script-name "timeclock.pl"))
    (when (get-buffer buffer-name)
      (progn
        (set-buffer buffer-name)
        (set-buffer-modified-p nil)
        (erase-buffer)))
    (set-buffer (get-buffer-create buffer-name))
    (start-process command-name buffer-name "perl" "-S" script-name)
    (switch-to-buffer buffer-name)))

And then use M-x timeclock-show-daily-report RET to display the report.

AUTHOR

Søren Lund, https://github.com/soren/

SEE ALSO

App::TimeClock::ConsolePrinter, App::TimeClock::HtmlPrinter, App::TimeClock::CsvPrinter, App::TimeClock::PrinterInterface

http://www.gnu.org/software/emacs/, http://www.emacswiki.org/emacs/TimeClock

BUGS

Please report any bugs at https://github.com/soren/App-TimeClock/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT

Copyright (C) 2012-2018 Søren Lund

This file is part of App::TimeClock.

App::TimeClock is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

App::TimeClock is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with App::TimeClock. If not, see <http://www.gnu.org/licenses/>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment