Código:
char* GetTimeUp() {
DWORD lpTime;
DWORD lpSecs;
DWORD lpMins;
DWORD lpHours;
DWORD lpDays;
lpTime = GetTickCount();
lpSecs = lpTime / 1000;
lpDays = lpSecs / (24 * 3600);
if (lpDays > 0) {
lpSecs -= (24 * 3600 * lpDays);
}
lpHours = lpSecs / 3600;
if (lpHours > 0) {
lpSecs -= (3600 * lpHours);
}
lpMins = lpSecs / 60;
lpSecs = lpSecs % 60;
//char lpBuffer2[1024];
//strcpy(lpBuffer, ultoa(lpDays, lpBuffer2, 10)); strcat(lpBuffer, "d, ");
//strcat(lpBuffer, ultoa(lpHours, lpBuffer2, 10)); strcat(lpBuffer, "h, ");
//strcat(lpBuffer, ultoa(lpMins, lpBuffer2, 10)); strcat(lpBuffer, "m, ");
//strcat(lpBuffer, ultoa(lpSecs, lpBuffer2, 10)); strcat(lpBuffer, "s");
static char lpBuffer[1024];
SYSTEMTIME lpSystemTime;
lpSystemTime.wDay = (unsigned short) lpDays;
lpSystemTime.wHour = (unsigned short) lpHours;
lpSystemTime.wMinute = (unsigned short) lpMins;
lpSystemTime.wSecond = (unsigned short) lpSecs;
GetTimeFormat(0, 0, &lpSystemTime, NULL, lpBuffer, sizeof(lpBuffer));
return lpBuffer;
}
funcion que coje los milisegundos k lleva el pc encendido y los pasa a 0d, 0h, 0m, 0s pero al usar ultoa y poner la opcion del compilador /NODEFAULTLIB da error y no quiero usar esa funcion, estoy intentando paasar el valor k devuelve gettickcount a hh:mm:ss o a una estructura SYSTEMTIME ... el objetivo es k me devuelva un valo char* asin 0d, 0h, 0m, 0s ...
gracias
saludos!!!