/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : Clock.h                                                       */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _CLOCK_H
#define _CLOCK_H

#include <sys/time.h>
#include "TaskInterface.h"

#define ClockServerName "clockServer"

/*
CLASS 
Clock

DESCRIPTION
Clock provides time to clients

AUTHOR
Tom O'Reilly
*/

class Clock : public TaskInterface {

public:

  Clock(const char *name);
  ~Clock();

  //////////////////////////////////////////////////////////////////
  // Seconds since January 1, 1970
  virtual time_t getTime();

  //////////////////////////////////////////////////////////////////
  // Clock request structure
  struct ClockRequest : Request {
  };

  //////////////////////////////////////////////////////////////////
  // Clock reply structure
  struct ClockReply : Reply {
    time_t t;
  };


  //////////////////////////////////////////////////////////////////
  // RequestCodes for ClockServer
  enum RequestCodes {
    GetTime
  };


  enum EventCode {
    TickEvent
  };

protected:

  ClockRequest _clockRequest;
  ClockReply _clockReply;

};

#endif
