0bae3725c5263027aad7f1eac6c92353be0d3810
[crypto_lab3.git] / src / Utils.cpp
1 #include "Utils.h"
2
3 #include <iostream>
4 using namespace std;
5
6 void Utils::print(string name, mpz_class value)
7 {
8 cout << name << ": " << value << endl;
9 }
10
11 Timer::Timer() :
12 time(chrono::high_resolution_clock::now())
13 {}
14
15 int Timer::ms() const
16 {
17 return chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - this->time).count();
18 }
19
20 void Timer::reset()
21 {
22 this->time = chrono::high_resolution_clock::now();
23 }
24
25 ostream& operator<<(ostream& os, const Timer& t)
26 {
27 os << t.ms() << " ms";
28 return os;
29 }