OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [frv/] [sim-time.c] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* sim-time.c -- stubs so clock can be linked in.
2
 *
3
 * Copyright (c) 2002 Red Hat, Inc
4
 *
5
 * The authors hereby grant permission to use, copy, modify, distribute,
6
 * and license this software and its documentation for any purpose, provided
7
 * that existing copyright notices are retained in all copies and that this
8
 * notice is included verbatim in any distributions. No written agreement,
9
 * license, or royalty fee is required for any of the authorized uses.
10
 * Modifications to this software may be copyrighted by their authors
11
 * and need not follow the licensing terms described here, provided that
12
 * the new terms are clearly indicated on the first page of each file where
13
 * they apply.
14
 */
15
#include <errno.h>
16
#include <sys/time.h>
17
#include <sys/times.h>
18
#include "glue.h"
19
 
20
/*
21
 * time -- simulator interface to return current time in seconds.
22
 */
23
__asm__ ("\
24
        .text\n\
25
        .globl  _sim_time\n\
26
        .type   _sim_time,@function\n\
27
_sim_time:\n\
28
        setlos  #18, gr7\n\
29
        tira    gr0, #0\n\
30
        ret\n\
31
.Lsim:\n\
32
        .size   _sim_time,.Lsim-_sim_time");
33
 
34
extern time_t _sim_time (void) __asm__("_sim_time");
35
 
36
 
37
/*
38
 * time -- return current time in seconds.
39
 */
40
time_t
41
_DEFUN (time, time (t),
42
        time_t *t)
43
{
44
  time_t ret = _sim_time ();
45
 
46
  if (t)
47
    *t = ret;
48
 
49
  return ret;
50
}
51
 
52
/*
53
 * _times -- no clock, so return an error.
54
 */
55
int
56
_DEFUN (_times, _times (buf),
57
        struct tms *buf)
58
{
59
  errno = EINVAL;
60
  return (-1);
61
}
62
 
63
/*
64
 * _gettimeofday -- implement in terms of time, which means we can't return the
65
 * microseconds.
66
 */
67
int
68
_DEFUN (_gettimeofday, _gettimeofday (tv, tz),
69
        struct timeval *tv _AND
70
        void *tzvp)
71
{
72
  struct timezone *tz = tzvp;
73
  if (tz)
74
    tz->tz_minuteswest = tz->tz_dsttime = 0;
75
 
76
  tv->tv_usec = 0;
77
  tv->tv_sec = _sim_time ();
78
  return 0;
79
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.