Gui Buttons Single and Double click

Hey guys im new to unity and programming, and am having difficulty making a gui button that will respond to single and double clicks with different functions for each type. Example: In an rts game when u single click on a units UI button it selects that unit, when u double click that UI button it moves the camera to the players position. If anyone can lead me to how to go about doing this it would b greatly appreciated!

save a time stamp for the last click and then check the current click to see if it is less than a short amount of time. e.g.

var lastClick : float = 0;

if(GUI.Button(Rect(someRect),"double click button")){
     // do something
     // do something else
  lastClick = Time.time;

Do just what spinal Jack said but also save a reference to the rectangle used as the Rect() in drawButton. Then on the second click check the time and also check to see if the saved rect contains the mouseposition. If it does then it's a double click, if it's not then it's a different button click.

heya.....i want a code such that i when i click a automatically clicks all other specified buttons...................regards