Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
ad3bb9bb
Commit
ad3bb9bb
authored
Sep 14, 2016
by
Trent Houliston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include the cmath header for std::lround.
Fix spaces before parens for style guide.
parent
2f597687
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
include/pybind11/chrono.h
+7
-6
No files found.
include/pybind11/chrono.h
View file @
ad3bb9bb
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#pragma once
#pragma once
#include "pybind11.h"
#include "pybind11.h"
#include <cmath>
#include <chrono>
#include <chrono>
#include <datetime.h>
#include <datetime.h>
...
@@ -26,7 +27,7 @@ public:
...
@@ -26,7 +27,7 @@ public:
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
// Lazy initialise the PyDateTime import
// Lazy initialise the PyDateTime import
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
src
)
return
false
;
if
(
!
src
)
return
false
;
// If they have passed us a datetime.delta object
// If they have passed us a datetime.delta object
...
@@ -52,7 +53,7 @@ public:
...
@@ -52,7 +53,7 @@ public:
static
handle
cast
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
static
handle
cast
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
// Declare these special duration types so the conversions happen with the correct primitive types (int)
// Declare these special duration types so the conversions happen with the correct primitive types (int)
using
dd_t
=
duration
<
int
,
std
::
ratio
<
86400
>>
;
using
dd_t
=
duration
<
int
,
std
::
ratio
<
86400
>>
;
...
@@ -75,7 +76,7 @@ public:
...
@@ -75,7 +76,7 @@ public:
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
// Lazy initialise the PyDateTime import
// Lazy initialise the PyDateTime import
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
src
)
return
false
;
if
(
!
src
)
return
false
;
if
(
PyDateTime_Check
(
src
.
ptr
()))
{
if
(
PyDateTime_Check
(
src
.
ptr
()))
{
...
@@ -98,7 +99,7 @@ public:
...
@@ -98,7 +99,7 @@ public:
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
// Lazy initialise the PyDateTime import
// Lazy initialise the PyDateTime import
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
time_t
tt
=
system_clock
::
to_time_t
(
src
);
time_t
tt
=
system_clock
::
to_time_t
(
src
);
// this function uses static memory so it's best to copy it out asap just in case
// this function uses static memory so it's best to copy it out asap just in case
...
@@ -129,7 +130,7 @@ public:
...
@@ -129,7 +130,7 @@ public:
bool
load
(
handle
src
,
bool
)
{
bool
load
(
handle
src
,
bool
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
// If they have passed us a datetime.delta object
// If they have passed us a datetime.delta object
if
(
PyDelta_Check
(
src
.
ptr
()))
{
if
(
PyDelta_Check
(
src
.
ptr
()))
{
...
@@ -155,7 +156,7 @@ public:
...
@@ -155,7 +156,7 @@ public:
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
// Lazy initialise the PyDateTime import
// Lazy initialise the PyDateTime import
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
// Declare these special duration types so the conversions happen with the correct primitive types (int)
// Declare these special duration types so the conversions happen with the correct primitive types (int)
using
dd_t
=
duration
<
int
,
std
::
ratio
<
86400
>>
;
using
dd_t
=
duration
<
int
,
std
::
ratio
<
86400
>>
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment