proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
Time.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015-present, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
*/
10
#include <
proxygen/lib/utils/Time.h
>
11
12
#include <
folly/portability/OpenSSL.h
>
13
#include <openssl/ossl_typ.h>
14
15
namespace
proxygen
{
16
17
std::string
getDateTimeStr
(
const
ASN1_TIME*
const
time
) {
18
if
(!time) {
19
return
""
;
20
}
21
22
constexpr
auto
bufSize = 32;
23
char
buf[bufSize] = {0};
24
25
auto
bio = BIO_new(BIO_s_mem());
26
if
(!bio) {
27
return
""
;
28
}
29
30
ASN1_TIME_print(bio, time);
31
const
auto
readResult = BIO_read(bio, buf, bufSize - 1);
32
BIO_free(bio);
33
34
return
((readResult <= 0) ?
""
:
std::string
(buf));
35
}
36
}
Time.h
proxygen::getDateTimeStr
std::string getDateTimeStr(const ASN1_TIME *const time)
Definition:
Time.cpp:17
string
const char * string
Definition:
Conv.cpp:212
proxygen
Definition:
ExMessageHandler.h:14
folly::detail::distributed_mutex::time
std::chrono::nanoseconds time()
Definition:
DistributedMutex-inl.h:190
OpenSSL.h
proxygen
lib
utils
Time.cpp
Generated by
1.8.11