How can I automatically keep track of in-office hours when I connect to my office Wi-Fi? I'm looking for a solution that starts a timer whenever I sign in to my office wifi and stops it when I've left. It should essentially log the hours I've spent at the office. I'm aware that there's iOS software for this, but I like my battery time as it is.

Extra bonus would be if the solution could log the hours in iCal automatically.
ControlPlane might be something you can use to accomplish this:


  ControlPlane determines where you are or what you are doing based on a
  number of available evidence sources and then automatically
  reconfigures your Mac based on your preferences.  Evidence sources can
  include your current location, visible WiFi networks, attached USB
  devices, running applications and more.  You can even write your own
  evidence sources using shell scripts!


In a nutshell, you can give ControlPlane an "evidence source",  such as 


  
  WiFi, either networks within range or based on the network you are
  currently connected to
  




Then perform a set of actions when entering (or leaving) a particular context, such as


  
  Open any file, including starting Applications
  Run a script, such as AppleScript or shell script
  




My thinking here is that if ControlPlane knows what your office wifi is called, you can create rules so that when you connect to it you start an application or shell script to start logging your hours. Then, when you disconnect, you stop the application or run another shell script to stop logging your hours. 

I realise this might not be the "silver bullet" solution you were looking for, but it might be worth a try. You'll still have to find some kind of timer app/script, but thats probably the easier part of the problem :)