Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
0ee97dd6
"git@developer.sourcefind.cn:gaoqiong/pybind11.git" did not exist on "dbc4bf68edb28ab3c0faa2d0b9ab709248562c7e"
Commit
0ee97dd6
authored
Aug 25, 2016
by
Trent Houliston
Browse files
Only import PyDateTime if we have to
parent
8fe2fa7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
include/pybind11/chrono.h
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