Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/cmd/gs/src/gp_sysv.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1992 Aladdin Enterprises.  All rights reserved.
2
 
3
  This software is provided AS-IS with no warranty, either express or
4
  implied.
5
 
6
  This software is distributed under license and may not be copied,
7
  modified or distributed except as expressly authorized under the terms
8
  of the license contained in the file LICENSE in this distribution.
9
 
10
  For more information about licensing, please refer to
11
  http://www.ghostscript.com/licensing/. For information on
12
  commercial licensing, go to http://www.artifex.com/licensing/ or
13
  contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14
  San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
*/
16
 
17
/* $Id: gp_sysv.c,v 1.4 2002/02/21 22:24:52 giles Exp $ */
18
/* System V Unix-specific routines for Ghostscript */
19
 
20
/* This file contains a couple of standard Unix library procedures */
21
/* that a few System V platforms don't provide. */
22
/* Note that this file is NOT used for SVR4 platforms. */
23
#include <errno.h>
24
#include "stdio_.h"
25
#include "time_.h"
26
#include <sys/types.h>
27
#include <sys/times.h>
28
#include <sys/stat.h>
29
#include <sys/param.h>
30
 
31
/* rename */
32
int
33
rename(const char *a, const char *b)
34
{
35
    if (access(a, 0) == -1)
36
	return (-1);
37
    unlink(b);
38
    if (link(a, b) == -1)
39
	return (-1);
40
    if (unlink(a) == -1) {
41
	unlink(b);		/* ??? */
42
	return (-1);
43
    }
44
    return (0);
45
}
46
 
47
/* gettimeofday */
48
#ifndef HZ
49
#  define	HZ	100	/* see sys/param.h */
50
#endif
51
int
52
gettimeofday(struct timeval *tvp, struct timezone *tzp)
53
{
54
    struct tms tms;
55
    static long offset = 0;
56
    long ticks;
57
 
58
    if (!offset) {
59
	time(&offset);
60
	offset -= (times(&tms) / HZ);
61
    }
62
    ticks = times(&tms);
63
    tvp->tv_sec = ticks / HZ + offset;
64
    tvp->tv_usec = (ticks % HZ) * (1000 * 1000 / HZ);
65
    return 0;
66
}