Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4e5d593a
Commit
4e5d593a
authored
Apr 05, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added times() (from time)
parent
003a7898
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
2 deletions
+50
-2
Modules/posixmodule.c
Modules/posixmodule.c
+50
-2
No files found.
Modules/posixmodule.c
View file @
4e5d593a
/***********************************************************
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
Copyright 1991
, 1992
by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.
All Rights Reserved
...
...
@@ -34,12 +34,22 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define NO_UNAME
#endif
#ifndef MSDOS
#define DO_TIMES
/* Comment this out if it causes trouble */
#endif
#include <signal.h>
#include <string.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef DO_TIMES
#include <sys/times.h>
#include <sys/param.h>
#include <errno.h>
#endif
#ifdef SYSV
#define UTIME_STRUCT
...
...
@@ -58,7 +68,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#endif
/* !SYSV */
#ifndef NO_UNISTD
#include <unistd.h>
/* Take this out if it doesn't exist */
#include <unistd.h>
/* Take this out
and hope the best
if it doesn't exist */
#endif
#include "allobjects.h"
...
...
@@ -691,6 +701,41 @@ posix_symlink(self, args)
}
#ifdef DO_TIMES
static
object
*
posix_times
(
self
,
args
)
object
*
self
;
object
*
args
;
{
struct
tms
t
;
clock_t
c
;
object
*
tuple
;
if
(
!
getnoarg
(
args
))
return
NULL
;
errno
=
0
;
c
=
times
(
&
t
);
if
(
c
==
(
clock_t
)
-
1
)
{
err_errno
(
IOError
);
return
NULL
;
}
tuple
=
newtupleobject
(
4
);
if
(
tuple
==
NULL
)
return
NULL
;
settupleitem
(
tuple
,
0
,
newfloatobject
((
double
)
t
.
tms_utime
/
HZ
));
settupleitem
(
tuple
,
1
,
newfloatobject
((
double
)
t
.
tms_stime
/
HZ
));
settupleitem
(
tuple
,
2
,
newfloatobject
((
double
)
t
.
tms_cutime
/
HZ
));
settupleitem
(
tuple
,
3
,
newfloatobject
((
double
)
t
.
tms_cstime
/
HZ
));
if
(
err_occurred
())
{
DECREF
(
tuple
);
return
NULL
;
}
return
tuple
;
}
#endif
static
struct
methodlist
posix_methods
[]
=
{
{
"chdir"
,
posix_chdir
},
{
"chmod"
,
posix_chmod
},
...
...
@@ -715,6 +760,9 @@ static struct methodlist posix_methods[] = {
#endif
{
"unlink"
,
posix_unlink
},
{
"utime"
,
posix_utime
},
#ifdef DO_TIMES
{
"times"
,
posix_times
},
#endif
#ifndef MSDOS
{
"_exit"
,
posix__exit
},
...
...
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