FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/cefpython/time_utils.pyx at cefpython31 · cztomczak/cefpython · GitHub
cztomczak
/
cefpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
477
Star
3.2k
Code
Issues
223
Pull requests
4
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
cefpython
/
time_utils.pyx
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (34 loc) · 1.32 KB
Breadcrumbs
cefpython
/
cefpython
/
time_utils.pyx
Copy path
File metadata and controls
36 lines (34 loc) · 1.32 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
#
License: New BSD License.
#
Website: http://code.google.com/p/cefpython/
cdef
void
DatetimeToCefTimeT(
object
pyDatetime, cef_time_t
&
timeT)
except
*
:
if
not
isinstance
(pyDatetime, datetime.datetime):
raise
Exception
(
"
Expected object of type datetime.datetime
"
)
timeT.year
=
pyDatetime.year
timeT.month
=
pyDatetime.month
timeT.day_of_week
=
pyDatetime.weekday()
timeT.day_of_month
=
pyDatetime.day
timeT.hour
=
pyDatetime.hour
timeT.minute
=
pyDatetime.minute
timeT.second
=
pyDatetime.second
#
Milliseconds/microseconds are ignored.
timeT.millisecond
=
0
cdef
object
CefTimeTToDatetime(cef_time_t timeT):
cdef
int
year
=
timeT.year
if
year
<
datetime.MINYEAR:
year
=
datetime.MINYEAR
if
year
>
datetime.MAXYEAR:
year
=
datetime.MAXYEAR
cdef
int
month
=
timeT.month
if
month
==
0
:
month
=
1
cdef
int
day_of_month
=
timeT.day_of_month
if
day_of_month
==
0
:
day_of_month
=
1
cdef
int
second
=
timeT.second
if
second
>
59
:
#
Ignore leap seconds as datetime.datetime() allows 0-59 only.
second
=
59
#
Milliseconds/microseconds are ignored.
return
datetime.datetime(year, month, day_of_month,
timeT.hour, timeT.minute, second)
Back
|
FazBrowse Home
|
New Git URL