help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [bug] _gst_get_milli_time isn't working under windows


From: GwenaelCasaccio
Subject: [Help-smalltalk] [bug] _gst_get_milli_time isn't working under windows
Date: Thu, 17 Jan 2013 02:09:46 -0700

Issue status update for http://smalltalk.gnu.org/node/689 Post a follow up: http://smalltalk.gnu.org/project/comments/add/689

Project:      GNU Smalltalk
Version:      <none>
Component:    VM
Category:     bug reports
Priority:     normal
Assigned to:  Unassigned
Reported by:  GwenaelCasaccio
Updated by:   GwenaelCasaccio
Status:       active

Here is a working version:

uint64_t
_gst_get_milli_time (void)
{ static mst_Boolean initialized = false;
static double frequencyToMicroseconds = 0.0;
static LARGE_INTEGER offset;

LARGE_INTEGER counter;
double microseconds;

if (initialized == false)
  {
    LARGE_INTEGER performanceFrequence;
    initialized = true;
    QueryPerformanceFrequency (&performanceFrequence);
    QueryPerformanceCounter (&offset);
    frequencyToMicroseconds = (double)performanceFrequence.QuadPart /
1000000.;
  }

QueryPerformanceCounter (&counter);
counter.QuadPart = counter.QuadPart - offset.QuadPart;
microseconds = (double)counter.QuadPart / frequencyToMicroseconds;
return microseconds / 1000.;
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]