Seeking C++ implementation of `hires_time_in_seconds()` [duplicate] - c++

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
High resolution timer with C++ and Linux?
double hires_time_in_seconds();
I'm looking for this function for Windows, Linux too if you have it.
It is mentioned in http://gafferongames.com/game-physics/fix-your-timestep/.
I've looked on the web.
I know it's not a standard function but if anybody has an implementation that they want to share, that would be great.
Failing that, I need something as fine grained as possible to do synchronization in a client server game.

It's not a real function, it's just a self-descriptive placeholder name used in that blog post's example code.
For Windows, you'll want to use QueryPerformanceCounter along with QueryPerformanceFrequency. For Unix-based OSes, you'll want to use gettimeofday(3).

Related

RegistryNotifyCallback equivalent for Windows Phone [duplicate]

This question already has an answer here:
Callback for phone contacts modification
(1 answer)
Closed 8 years ago.
In Windows Mobile I could use RegistryNotifyCallback and get notified when certain data changed.
Is there any equivalent to this function in Windows Phone 8?
Since RegistryNotifyCallback was used in C++ (unmanaged code) and WP uses .Net (managed code), is there any way to directly import and use the necessary C++ DLLs?
The functionality I'm looking for here is to get notified if a Contact from my People Hub changes any of its data, outside my application. I've asked this question before and the short answer was "the is no way of doing this", but I'm still hoping there is.
I've asked this question before and the short answer was "the is no way of doing this",
Why are you asking again then? It's still the same answer. And we don't have any intentions, whatsoever, to allow 3rd party developers to access data from limited contact stores.

Equivalent to windows.h for mac [duplicate]

This question already has answers here:
Where can I get windows.h for Mac?
(3 answers)
Closed 4 months ago.
Is there any equivalent to windows.h for mac?
I've been googling it but I can't find anything.
I don't know if it matters but I am currently using Mountain Lion.
There is no direct equivalent. That is, no file for file substitute. It's a different platform after all. You will simply have to work with their API. And without knowing exactly what it is you want to do and what functionality you intend to use, it's hard to provide any additional information.
There is the Carbon API. Or better said, there was. Specifically since Mountain Lion, this API has been deprecated. The aforementioned link mentions some alternatives to deprecated functionality, though the Objective-C route might be a more easily manageable alternative.

Platform-Independent Way to Obtain IP-Address in C++ [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Get the IP Address of local computer
I want to be able to get the IP address for the machine I'm on in C++ without querying external www.whatsmyip.com, but also want to do it in a platform-independent way. I can find specific examples for both Windows and Linux, but can't think of an easy way to do this in a platform-independent way. I would also consider options of putting an if-statement in depending on the Operating System if this seems like the best/only method.
If you are able to use boost, I highly recommend the boost::asio, which is about as cross-platform as you're going to get.
An alternative to boost::asio may be the POCO Network Library.

Checking how many members is there in a class [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
C++ macro/metaprogram to determine number of members at compile time
is there a way to detect at compile time how many members class has?
I've looked the web but no results.
There are API's for static analysis tools that could do this.
Here at my work I use a product called understand 4 C++. It has a nifty C API, for which I wrote a managed C++/CLI wrapper API. That allows you to write tools using C# to target their API. Using this I have written tools that do things similar to what you want to do.
In your case, you could write a tool, get it to do what you want, and then call this tool as a post build event.
If you search this website for static analysis API's then you will find other useful hits.

Well tested C/C++ lock free queue? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Is there a production ready lock-free queue or hash implementation in C++
I am looking for a well-tested, publicly available C/C++ implementation of a lock free queue.
I need at least multiple-producers/single-consumer functionality. Multiple-consumers is even better, if exists.
I'm targetting VC's _Interlocked... intrinsics, though anything which is straight forward to port would be fine.
Could anyone give any pointers?
If you're ok to go down that route, there's always the Windows thread pool.