/**
* @file Despertador_windows.c
* @author G.A.
* @date 06/05/2019
* @brief  A example to sleep and print messages (Win32 Version)
* @details  A C languaje  file example to sleep some time and after print repeated messages to stdout(For Linux and Windows Version)
*
*/

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>


/*! \fn unsigned esperar_tiempo(int sec)
\brief Sleep for \sec seconds.
\param sec The number of seconds to sleep.
\return a unsigned int (the number of seconds asleep).
*/
unsigned esperar_tiempo (int sec) {

   if (sec <= 0)
      return 0;
   else {
      Sleep(sec*1000);
      return(sec);
   }
}

int main (int argc, const char * argv[]) {

   int i;

   if (argc < 3) {
      printf("Uso: %s tiempo mensaje\n", argv[0]);
      exit(1);
           }

   esperar_tiempo(atoi(argv[1]));

   for (i=2; i<argc; i++)
      printf("%s\n", argv[i]);
}