/** * Some general functions for SICS. Most part is moved from ofac.c * * copyright: see file COPYRIGHT * * moved from acces.c and ascon.c Markus Zolliker Jan 2010 */ #include #include #include #include #include "fortify.h" #include "sics.h" static char *aCode[] = { "internal", "mugger", "user", "spy", NULL }; static int iCodes = 4; /*--------------------------------------------------------------------------*/ int decodeSICSPriv(char *privText) { int code = 0; strtolower(privText); while (aCode[code] != NULL) { if (strcmp(aCode[code], privText) == 0) { return code; } code++; } if (code >= iCodes) { return -1; } return -1; } /*-------------------------------------------------------------------------*/ double DoubleTime(void) { struct timeval now; /* the resolution of this function is usec, if the machine supports this and the mantissa of a double is 51 bits or more (31 for sec and 20 for mic$ */ gettimeofday(&now, NULL); return now.tv_sec + now.tv_usec / 1e6; }