mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 20:46:59 +03:00
6317633148
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2653 1f5c12ca-751b-0410-a591-d2e778427230
29 lines
509 B
C++
29 lines
509 B
C++
// 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
|