X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Ftime.h;h=7d925d1b48240854672371c1b72aff55231bf9cc;hb=1a2ceb635b38ebe136f806bd391ff600863e1691;hp=2aafdb23ef9d9999a0640c1b435bcef2d1fd25ef;hpb=21ff84a0d872ff069d4ec62d0a5bed21bcfeeac5;p=lttv.git diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index 2aafdb23..7d925d1b 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -23,6 +23,8 @@ #include #include +#include + typedef struct _LttTime { unsigned long tv_sec; unsigned long tv_nsec; @@ -213,7 +215,7 @@ static inline LttTime ltt_time_div(LttTime t1, double d) static inline guint64 ltt_time_to_uint64(LttTime t1) { - return (guint64)((t1.tv_sec*LTT_TIME_UINT_SHIFT_CONST) >> LTT_TIME_UINT_SHIFT) + return (((guint64)t1.tv_sec*LTT_TIME_UINT_SHIFT_CONST) << LTT_TIME_UINT_SHIFT) + (guint64)t1.tv_nsec; } @@ -246,4 +248,17 @@ static inline LttTime ltt_time_from_uint64(guint64 t1) return res; } +inline LttTime ltt_get_time(LttTrace t, void *ptr) +{ + LttTime output; + + output.tv_sec = + (guint64) (t->reverse_byte_order ? GUINT64_SWAP_LE_BE(ptr): ptr); + ptr += sizeof(guint64); + output.tv_nsec = + (guint64) (t->reverse_byte_order ? GUINT64_SWAP_LE_BE(ptr): ptr); + + return output; +} + #endif // LTT_TIME_H