Steve,
How about using crt time date functions instead of Windows?
Here is a bcx -> c demo.
James
// *********************************************************************
// Created with BCX32 - BASIC To C/C++ Translator (V) 9.0.0.7 (2012/03/23)
// BCX (c) 1999 - 2012 by Kevin Diggins
// *********************************************************************
// Translated for compiling with an ANSI/ISO C Compiler
// *********************************************************************
// ***************************************************
// types from winapi that may be needed
// ***************************************************
typedef char *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR;
typedef unsigned int UINT;
typedef char byte;
typedef unsigned long DWORD,ULONG;
typedef unsigned char UCHAR;
//----------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// *************************************************
// User's GLOBAL ENUM blocks
// *************************************************
// *************************************************
// System Defined Constants
// *************************************************
#define cSizeOfDefaultString 2048
// *************************************************
// User Defined Constants
// *************************************************
// *************************************************
// Standard Prototypes
// *************************************************
// char* BCX_TmpStr(size_t,size_t= 128,int= 1);
char* BCX_TmpStr(size_t,size_t,int);
// char* timef(int=0, int=0);
char* timef(int,int);
// *************************************************
// User Defined Types And Unions
// *************************************************
// *************************************************
// System Variables
// *************************************************
// *************************************************
// User Global Variables
// *************************************************
static PCHAR *g_argv;
static int g_argc;
// *************************************************
// User Global Initialized Arrays
// *************************************************
// *************************************************
// Runtime Functions
// *************************************************
#ifndef BCXTmpStrSize
#define BCXTmpStrSize 2048
#endif
char *BCX_TmpStr (size_t Bites,size_t iPad,int iAlloc)
{
static int StrCnt;
static char *StrFunc[BCXTmpStrSize];
StrCnt=(StrCnt + 1) & (BCXTmpStrSize-1);
if(StrFunc[StrCnt]) {free (StrFunc[StrCnt]); StrFunc[StrCnt] = NULL;}
#if defined BCX_MAX_VAR_SIZE
if(Bites*sizeof(char)>BCX_MAX_VAR_SIZE)
{
printf("Buffer Overflow caught in BCX_TmpStr - requested space of %d EXCEEDS %d\n",(int)(Bites*sizeof(char)),BCX_MAX_VAR_SIZE);
abort();
}
#endif
if(iAlloc) StrFunc[StrCnt]=(char*)calloc(Bites+128,sizeof(char));
return StrFunc[StrCnt];
}
char *timef (int t, int u)
{
time_t elapse_time;
struct tm *tp;
char *strtmp = BCX_TmpStr(256,128,1);
time (&elapse_time);
if(u==0)
tp = localtime(&elapse_time);
else
tp = gmtime(&elapse_time);
switch (t)
{
case 0:
strftime(strtmp,256,"%H:%M:%S",tp); break;
case 1:
strftime(strtmp,256,"%H",tp); break;
case 2:
strftime(strtmp,256,"%M",tp); break;
case 3:
strftime(strtmp,256,"%S",tp); break;
case 4:
strftime(strtmp,256,"%p",tp); break;
case 5:
strftime(strtmp,256,"%Y",tp); break;
case 6:
strftime(strtmp,256,"%m",tp); break;
case 7:
strftime(strtmp,256,"%d",tp); break;
case 8:
strftime(strtmp,256,"%A",tp); break;
case 9:
strftime(strtmp,256,"%w",tp); break;
case 10:
strftime(strtmp,256,"%j",tp); break;
case 11:
strftime(strtmp,256,"%U",tp); break;
}
return strtmp;
}
// ************************************
// User Subs and Functions
// ************************************
// *************************************************
// Main Program
// *************************************************
int main(int argc, char *argv[])
{
g_argc = argc;
g_argv = argv;
printf("%s%s\n","Printing TIME$ ",timef( 0 , 0));
printf("%s\n","-----------------");
printf("%s%s\n","Printing HOUR ",timef( 1 , 0));
printf("%s%s\n","Printing MINUTE ",timef( 2 , 0));
printf("%s%s\n","Printing SECOND ",timef( 3 , 0));
printf("%s%s\n","Printing AMPM ",timef( 4 , 0));
printf("%s\n","-----------------");
printf("%s%s\n","Printing YEAR ",timef( 5 , 0));
printf("%s%s\n","Printing MONTH ",timef( 6 , 0));
printf("%s%s\n","Printing DAY ",timef( 7 , 0));
printf("%s\n","-----------------");
printf("%s%s\n","Printing DAYNAME ",timef( 8 , 0));
printf("%s%s\n","Printing WEEKDAY ",timef( 9 , 0));
printf("%s%s\n","Printing YEARDAY ",timef( 10 , 0));
printf("%s%s\n","Printing WEEK ",timef( 11 , 0));
return 0; /* End of main program */
}