ACPI administration advocacy advocacy advocacy opinion alsa amarok apache apple apt aptitude audio audo authentication automount avi awk bash BIOS boot business cache calendar calibre cdr cdrecord censorship commandline computerscience console convert cron cut database date debian degree design desktop development disk dpkg dvd economics education emacs email europe exim faad ffmpeg file files firefox firewall flash foss freedom ftp fun fuse git gnumeric graphics grep growisofs grub gtkpod hardware hardware html idiocy image imagemagick images installation ip iphone ipod iptables iso itunes ivman kde kernel keyboard knoppix lame laptop latex linux locale lockin longlines m4a microsoft mimetypes minitab mount mp3 mp4 mplayer multimedia music mysql network nfs nfs4 nmap openbox openoffice opinion opinion partition pdf perl php politics postgresql printing privacy programming rant remote rhythmbox rss rsync rxvt scp screengrab screenshot script scripting scsi security sed server shell siteadmin sitenews sitesoftware skype skype slackware sound sox spam spreadsheet ssh statistics subversion sudo svk swap t23 t43 terminal text thinkpad thunderbird time timezone ubuntu udev upgrade usb usbmount users uuid versioncontrol vfat video vnc windows wine wordpress wordprocessing X40 xwindows xwindows youtube
I searched high and low for a stopwatch that I could run on my laptop. Computers aren't the most accurate time pieces, it's true, but I didn't care. My task wasn't going to require any sort of accuracy.
Well, I couldn't find one. In fact the closest thing I found was the project management tool gnotime. This wasn't quite what I was looking for.
So, I wrote my own. The resolution is only in seconds and it's not very pretty. It suited my purpose though:
#!/bin/bash
BEGIN=$(date +%s)
while true; do
NOW=$(date +%s)
let DIFF=$(($NOW - $BEGIN))
let MINS=$(($DIFF / 60))
let SECS=$(($DIFF % 60))
echo Time elapsed: $MINS:`printf %02d $SECS`
done
Cute idea.
I made two potentially useful changes, one functional, one aesthetic:
Functional - insert: usleep 10000 ...at the top of the loop to reduces update frequency from *very* fast to once every 100th of a second (massive reduction in CPU/power use)
Aesthetic - replace the echo command with: printf "\rTime elapsed: %d:%02d" $MINS $SECS ...to avoid scrolling.
this doesent work
Posted by Guest User on 2007-12-31 08:36:22.