/*---------------------------------------------------------

 File : fispex_protect.h 

 Add a simple protection to avoid use of FISPEX after a
 certain date
 (End of 2006)

 -----------------------------------------------------------*/

#ifndef fispex_protect_H
#define fispex_protect_H

#ifdef _MSC_VER 
inline void fispex_protect() { }

#else
#include <sys/time.h>
#include <time.h>
#include <cstdio>
#include <cstdlib>

static const char* fispex_message = "\n\nYour version of FISPEX has expired.\n\n";

inline void fispex_protect() {
  struct tm desired;
  desired.tm_sec = 0;
  desired.tm_min = 0;
  desired.tm_hour = 0;
  desired.tm_mday = 1;
  desired.tm_mon = 0;
  desired.tm_year = 107;
  desired.tm_wday = 0;
  desired.tm_yday = 0;
  desired.tm_isdst = 0;
  
  const time_t Td = mktime(&desired), T = time(NULL);

  if (T>Td) {
    std::fprintf(stderr,fispex_message);
    std::exit(0);
  }
  
}
#endif

#endif
