Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
8a10a67e
Commit
8a10a67e
authored
Sep 26, 2014
by
Charles Blake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename test files.
parent
839d119c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
71 deletions
+71
-71
tests/run/libc_time.pyx
tests/run/libc_time.pyx
+47
-0
tests/run/posix_sys_time.pyx
tests/run/posix_sys_time.pyx
+0
-33
tests/run/posix_time.pyx
tests/run/posix_time.pyx
+24
-38
No files found.
tests/run/libc_time.pyx
0 → 100644
View file @
8a10a67e
# tag: posix
from
libc.stdlib
cimport
getenv
from
posix.stdlib
cimport
setenv
,
unsetenv
from
posix.time
cimport
*
def
test_time
():
"""
>>> test_time()
"""
cdef
time_t
t1
,
t2
t1
=
time
(
NULL
)
assert
t1
!=
0
t1
=
time
(
&
t2
)
assert
t1
==
t2
def
test_mktime
():
"""
>>> test_mktime() # doctest:+ELLIPSIS
(986138177, ...'Sun Apr 1 15:16:17 2001
\
\
n')
"""
cdef
tm
t
,
gmt
cdef
time_t
tt
cdef
char
*
ct
cdef
char
*
tz
tz
=
getenv
(
"TZ"
)
setenv
(
"TZ"
,
"UTC"
,
1
)
tzset
()
t
.
tm_sec
=
17
t
.
tm_min
=
16
t
.
tm_hour
=
15
t
.
tm_year
=
101
t
.
tm_mon
=
3
t
.
tm_mday
=
1
t
.
tm_isdst
=
0
tt
=
mktime
(
&
t
)
assert
tt
!=
-
1
ct
=
ctime
(
&
tt
)
assert
ct
!=
NULL
if
tz
:
setenv
(
"TZ"
,
tz
,
1
)
else
:
unsetenv
(
"TZ"
)
tzset
()
return
tt
,
ct
tests/run/posix_sys_time.pyx
deleted
100644 → 0
View file @
839d119c
# tag: posix
from
posix.sys_time
cimport
*
def
test_itimer
(
sec
,
usec
):
"""
>>> test_itimer(10, 2)
(10, 2)
"""
cdef
itimerval
t
,
gtime
t
.
it_interval
.
tv_sec
=
sec
t
.
it_interval
.
tv_usec
=
usec
t
.
it_value
.
tv_sec
=
sec
t
.
it_value
.
tv_usec
=
usec
ret
=
setitimer
(
ITIMER_REAL
,
&
t
,
NULL
)
assert
ret
==
0
ret
=
getitimer
(
ITIMER_REAL
,
&
gtime
)
assert
ret
==
0
t
.
it_interval
.
tv_sec
=
0
t
.
it_interval
.
tv_usec
=
0
t
.
it_value
.
tv_sec
=
0
t
.
it_value
.
tv_usec
=
0
ret
=
setitimer
(
ITIMER_REAL
,
&
t
,
NULL
)
return
gtime
.
it_interval
.
tv_sec
,
gtime
.
it_interval
.
tv_usec
def
test_gettimeofday
():
"""
>>> test_gettimeofday()
"""
cdef
timeval
t
ret
=
gettimeofday
(
&
t
,
NULL
)
assert
ret
==
0
tests/run/posix_time.pyx
View file @
8a10a67e
# tag: posix
from
libc.stdlib
cimport
getenv
from
posix.stdlib
cimport
setenv
,
unsetenv
from
posix.time
cimport
*
from
posix.sys_time
cimport
*
def
test_
time
(
):
def
test_
itimer
(
sec
,
usec
):
"""
>>> test_time()
>>> test_itimer(10, 2)
(10, 2)
"""
cdef
time_t
t1
,
t2
t1
=
time
(
NULL
)
assert
t1
!=
0
t1
=
time
(
&
t2
)
assert
t1
==
t2
cdef
itimerval
t
,
gtime
t
.
it_interval
.
tv_sec
=
sec
t
.
it_interval
.
tv_usec
=
usec
t
.
it_value
.
tv_sec
=
sec
t
.
it_value
.
tv_usec
=
usec
ret
=
setitimer
(
ITIMER_REAL
,
&
t
,
NULL
)
assert
ret
==
0
ret
=
getitimer
(
ITIMER_REAL
,
&
gtime
)
assert
ret
==
0
t
.
it_interval
.
tv_sec
=
0
t
.
it_interval
.
tv_usec
=
0
t
.
it_value
.
tv_sec
=
0
t
.
it_value
.
tv_usec
=
0
ret
=
setitimer
(
ITIMER_REAL
,
&
t
,
NULL
)
return
gtime
.
it_interval
.
tv_sec
,
gtime
.
it_interval
.
tv_usec
def
test_
mktime
():
def
test_
gettimeofday
():
"""
>>> test_mktime() # doctest:+ELLIPSIS
(986138177, ...'Sun Apr 1 15:16:17 2001
\
\
n')
>>> test_gettimeofday()
"""
cdef
tm
t
,
gmt
cdef
time_t
tt
cdef
char
*
ct
cdef
char
*
tz
tz
=
getenv
(
"TZ"
)
setenv
(
"TZ"
,
"UTC"
,
1
)
tzset
()
t
.
tm_sec
=
17
t
.
tm_min
=
16
t
.
tm_hour
=
15
t
.
tm_year
=
101
t
.
tm_mon
=
3
t
.
tm_mday
=
1
t
.
tm_isdst
=
0
tt
=
mktime
(
&
t
)
assert
tt
!=
-
1
ct
=
ctime
(
&
tt
)
assert
ct
!=
NULL
if
tz
:
setenv
(
"TZ"
,
tz
,
1
)
else
:
unsetenv
(
"TZ"
)
tzset
()
return
tt
,
ct
cdef
timeval
t
ret
=
gettimeofday
(
&
t
,
NULL
)
assert
ret
==
0
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