MaxScale/server/core/test/test_http.cc
2022-01-04 15:47:38 +02:00

40 lines
1.0 KiB
C++

/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2026-01-04
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <iostream>
#include <maxbase/assert.h>
#include <maxscale/http.hh>
using std::string;
using std::cout;
using std::endl;
int main(int argc, char** argv)
{
time_t now = time(NULL);
string date = http_to_date(now);
time_t converted_now = http_from_date(date);
string converted_date = http_to_date(converted_now);
cout << "Current linux time: " << now << endl;
cout << "HTTP-date from current time: " << date << endl;
cout << "Converted Linux time: " << converted_now << endl;
cout << "Converted HTTP-date: " << converted_date << endl;
mxb_assert(now == converted_now);
mxb_assert(date == converted_date);
return 0;
}