-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbinary_string.cpp
More file actions
39 lines (32 loc) · 773 Bytes
/
Copy pathbinary_string.cpp
File metadata and controls
39 lines (32 loc) · 773 Bytes
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
31
32
33
34
35
36
37
38
39
#include "binary_string.hpp"
binary_string::binary_string()
: expiry_set_(false)
{
}
binary_string::binary_string(const std::vector<unsigned char>& bdata)
: expiry_set_(false), bdata_(bdata)
{
}
binary_string::binary_string(const std::vector<unsigned char>& bdata,
long long expiry_milliseconds)
: bdata_(bdata), expiry_set_(true)
{
expiry_time_ = chrono::system_clock::now()
+ chrono::milliseconds(expiry_milliseconds);
}
const std::vector<unsigned char>& binary_string::bdata() const
{
return bdata_;
}
std::vector<unsigned char>& binary_string::bdata()
{
return bdata_;
}
bool binary_string::has_expired() const
{
if (!expiry_set_)
{
return false;
}
return expiry_time_ < chrono::system_clock::now();
}