b60be5094f1ae04f544db0531c228d53182e0015
[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 ostream& operator<<(ostream& os, const Timer& t)
21 {
22 os << t.ms() << " ms";
23 return os;
24 }