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.

有帮助吗?

解决方案

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)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top