Domanda

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.

È stato utile?

Soluzione

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)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top