mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-02 00:45:58 +00:00
Reformatting using AStyle
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
@@ -21,34 +21,34 @@
|
||||
// We have our own epoch.
|
||||
//
|
||||
|
||||
boost::posix_time::ptime ptEpoch()
|
||||
boost::posix_time::ptime ptEpoch ()
|
||||
{
|
||||
return boost::posix_time::ptime(boost::gregorian::date(2000, boost::gregorian::Jan, 1));
|
||||
return boost::posix_time::ptime (boost::gregorian::date (2000, boost::gregorian::Jan, 1));
|
||||
}
|
||||
|
||||
int iToSeconds(boost::posix_time::ptime ptWhen)
|
||||
int iToSeconds (boost::posix_time::ptime ptWhen)
|
||||
{
|
||||
return ptWhen.is_not_a_date_time()
|
||||
? -1
|
||||
: (ptWhen-ptEpoch()).total_seconds();
|
||||
return ptWhen.is_not_a_date_time ()
|
||||
? -1
|
||||
: (ptWhen - ptEpoch ()).total_seconds ();
|
||||
}
|
||||
|
||||
// Convert our time in seconds to a ptime.
|
||||
boost::posix_time::ptime ptFromSeconds(int iSeconds)
|
||||
boost::posix_time::ptime ptFromSeconds (int iSeconds)
|
||||
{
|
||||
return iSeconds < 0
|
||||
? boost::posix_time::ptime(boost::posix_time::not_a_date_time)
|
||||
: ptEpoch() + boost::posix_time::seconds(iSeconds);
|
||||
return iSeconds < 0
|
||||
? boost::posix_time::ptime (boost::posix_time::not_a_date_time)
|
||||
: ptEpoch () + boost::posix_time::seconds (iSeconds);
|
||||
}
|
||||
|
||||
// Convert from our time to UNIX time in seconds.
|
||||
uint64_t utFromSeconds(int iSeconds)
|
||||
uint64_t utFromSeconds (int iSeconds)
|
||||
{
|
||||
boost::posix_time::time_duration tdDelta =
|
||||
boost::posix_time::ptime(boost::gregorian::date(2000, boost::gregorian::Jan, 1))
|
||||
-boost::posix_time::ptime(boost::gregorian::date(1970, boost::gregorian::Jan, 1))
|
||||
+boost::posix_time::seconds(iSeconds)
|
||||
;
|
||||
boost::posix_time::time_duration tdDelta =
|
||||
boost::posix_time::ptime (boost::gregorian::date (2000, boost::gregorian::Jan, 1))
|
||||
- boost::posix_time::ptime (boost::gregorian::date (1970, boost::gregorian::Jan, 1))
|
||||
+ boost::posix_time::seconds (iSeconds)
|
||||
;
|
||||
|
||||
return tdDelta.total_seconds();
|
||||
return tdDelta.total_seconds ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user