/*--------------------------------------------------------------------
 * FICHERO:  TimSegun.c
 * OBJETIVO: Definir la funcin Tim_Segundo()
 * AUTOR:    Pedro Reina
 * FECHA:    J.20.4.1995
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------------
 * Ficheros de cabecera
 *------------------------------------------------------------------*/

#include "Tiempo.h"

#ifdef OLIMPO_PC
#include <dos.h>                /*  struct time  gettime()          */
#endif

#ifdef OLIMPO_QL
#include <qlib.h>               /* mt_rclck()  cn_date()            */
#include <stdlib.h>             /* atoi()                           */
#endif

/*--------------------------------------------------------------------
 * Definicin de funciones
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------Olimpo
 * FUNCION:  Tim_Segundo()
 * OBJETIVO: Decir el segundo en curso
 * ENTRADAS: Ninguna
 * SALIDAS:  El segundo en curso
 * EJEMPLO:  Tim_Segundo()
 *------------------------------------------------------------------*/

#ifdef OLIMPO_PC
octeto Tim_Segundo()
  {
  struct time t;
  gettime(&t);
  return ( (octeto) (t.ti_sec) );
  }
#endif

#ifdef OLIMPO_QL
octeto Tim_Segundo()
  {
  char FechaQL[25];

  cn_date (FechaQL,mt_rclck());
  FechaQL[22] = NULO;

  return ( (octeto) atoi(FechaQL+20) );
  }
#endif