source: Daodan/src/Daodan_Utility.c@ 292

Last change on this file since 292 was 276, checked in by rossy, 16 years ago

DDrMachineTime_Sixtieths

File size: 1.2 KB
RevLine 
[275]1#include <windows.h>
[272]2#include <stdlib.h>
3#include <stdarg.h>
[275]4#include <stdint.h>
[272]5#include "oni_stdio.h"
6
7#include "Daodan_Utility.h"
8#include "BFW_Utility.h"
9
10void __cdecl DDrStartupMessage(const char* fmt, ...)
11{
12 va_list ap;
13 va_start(ap, fmt);
14 char* buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1);
15
16 vsprintf(buffer, fmt, ap);
17 va_end(ap);
18
19 if (!ONgFileStartup)
20 if (!(ONgFileStartup = oni_fopen("startup.txt", "w")))
21 return;
22
23 oni_fprintf(ONgFileStartup, "%s\n", buffer);
24 free(buffer);
25
26 oni_fflush(ONgFileStartup);
27 return;
28}
[275]29
[276]30int64_t DDrMachineTime_Sixtieths()
31{
32 static int64_t LastTime, Time;
33 int64_t Current;
34
35 Current = LastTime + GetTickCount();
36
37 if (Current > Time)
38 {
39 LastTime += 1;
40 Current += 1;
41 }
42
43 Time = Current;
44
45 return (Time * 3) / 50;
46}
47
[275]48int64_t DDrMachineTime_High()
49{
50// LARGE_INTEGER PerfCount;
51//
52// if (!QueryPerformanceCounter(&PerfCount))
53// PerfCount.QuadPart = GetTickCount();
54//
55// return PerfCount.QuadPart;
56 return GetTickCount();
57}
58
59double DDrMachineTime_High_Frequency()
60{
61// LARGE_INTEGER Frequency;
62//
63// if (!QueryPerformanceFrequency(&Frequency))
64 return 1000.0;
65
66// return Frequency.QuadPart;
67}
Note: See TracBrowser for help on using the repository browser.