Question

How to use the GDKEvent's timestamp in c++? For example, I print it as unsigned int, its value is 4194719109, but the current time is 1395764110 which is gotten from time() of time.h. The current time of g_get_real_time() is 1395764110872217 which is a gint64 type value. it seems the g_get_real_time() is more accurate than time().

My purpose is to calculate how many times it has lasted from the time of GDKEvent occurred.

Was it helpful?

Solution

The time element of GdkEvent is in miliseconds. Comparing with g_get_monotonic_time() (which is in µs) divided by 1000 should work (make sure to check the sign and cast to guint32 before comparing)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top