File size: 523 Bytes
158b61b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
// memscore - in-memory phrase scoring for Statistical Machine Translation
// Christian Hardmeier, FBK-irst, Trento, 2010
// $Id$
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
#include <sys/time.h>
class Timestamp
{
private:
struct timeval tv_;
public:
typedef double time_difference;
Timestamp() {
gettimeofday(&tv_, NULL);
}
time_difference elapsed_time() const {
struct timeval tv2;
gettimeofday(&tv2, NULL);
return (tv2.tv_sec - tv_.tv_sec) * 1e6 + (tv2.tv_usec - tv_.tv_usec);
}
};
#endif
|