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
0ee97dd6
Commit
0ee97dd6
authored
Aug 25, 2016
by
Trent Houliston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only import PyDateTime if we have to
parent
8fe2fa7e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
include/pybind11/chrono.h
+6
-6
No files found.
include/pybind11/chrono.h
View file @
0ee97dd6
...
@@ -23,7 +23,7 @@ public:
...
@@ -23,7 +23,7 @@ public:
bool
load
(
handle
src
,
bool
)
{
bool
load
(
handle
src
,
bool
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
PyDateTime_IMPORT
;
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
src
)
return
false
;
if
(
!
src
)
return
false
;
if
(
PyDelta_Check
(
src
.
ptr
()))
{
if
(
PyDelta_Check
(
src
.
ptr
()))
{
...
@@ -41,7 +41,7 @@ public:
...
@@ -41,7 +41,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
;
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)
typedef
duration
<
int
,
std
::
ratio
<
86400
>>
dd_t
;
typedef
duration
<
int
,
std
::
ratio
<
86400
>>
dd_t
;
...
@@ -61,7 +61,7 @@ public:
...
@@ -61,7 +61,7 @@ public:
typedef
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>
type
;
typedef
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>
type
;
bool
load
(
handle
src
,
bool
)
{
bool
load
(
handle
src
,
bool
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
PyDateTime_IMPORT
;
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
src
)
return
false
;
if
(
!
src
)
return
false
;
if
(
PyDateTime_Check
(
src
.
ptr
()))
{
if
(
PyDateTime_Check
(
src
.
ptr
()))
{
...
@@ -82,7 +82,7 @@ public:
...
@@ -82,7 +82,7 @@ public:
static
handle
cast
(
const
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
static
handle
cast
(
const
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
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
...
@@ -108,7 +108,7 @@ public:
...
@@ -108,7 +108,7 @@ public:
typedef
std
::
chrono
::
time_point
<
Clock
,
Duration
>
type
;
typedef
std
::
chrono
::
time_point
<
Clock
,
Duration
>
type
;
bool
load
(
handle
src
,
bool
)
{
bool
load
(
handle
src
,
bool
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
PyDateTime_IMPORT
;
if
(
!
PyDateTimeAPI
)
{
PyDateTime_IMPORT
;
}
if
(
!
src
)
return
false
;
if
(
!
src
)
return
false
;
if
(
PyTime_Check
(
src
.
ptr
()))
{
if
(
PyTime_Check
(
src
.
ptr
()))
{
...
@@ -125,7 +125,7 @@ public:
...
@@ -125,7 +125,7 @@ public:
static
handle
cast
(
const
std
::
chrono
::
time_point
<
Clock
,
Duration
>
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
static
handle
cast
(
const
std
::
chrono
::
time_point
<
Clock
,
Duration
>
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
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)
typedef
duration
<
int
,
std
::
ratio
<
3600
>>
hh_t
;
typedef
duration
<
int
,
std
::
ratio
<
3600
>>
hh_t
;
...
...
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