[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetC/include time.h,NONE,1.1 Makefile.am,1.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetC/include time.h,NONE,1.1 Makefile.am,1.5,1.6 pthread.h,1.2,1.3 |
Date: |
Sun, 16 Feb 2003 22:24:46 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetC/include
In directory subversions:/tmp/cvs-serv2164/include
Modified Files:
Makefile.am pthread.h
Added Files:
time.h
Log Message:
Implement some of the ANSI C time routines.
--- NEW FILE ---
/*
* time.h - Time manipulation functions.
*
* This file is part of the Portable.NET C library.
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _TIME_H
#define _TIME_H
#include <features.h>
#include <sys/types.h>
#include <stddef.h>
__BEGIN_DECLS
/*
* Time values and specifications.
*/
struct timeval
{
time_t tv_sec;
long tv_usec;
};
struct timespec
{
time_t tv_sec;
long tv_nsec;
};
struct itimerspec
{
struct timespec it_interval;
struct timespec it_value;
};
/*
* Split out time information.
*/
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
/*
* Useful constants.
*/
#define CLOCKS_PER_SEC 1000000L
#define CLOCK_REALTIME 0
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC 4
#define TIMER_ABSTIME 1
/*
* Functions.
*/
extern char *asctime (const struct tm *__tp);
extern char *asctime_r (const struct tm *__tp, char * __restrict __buf);
extern clock_t clock (void);
extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id);
extern int clock_getres (clockid_t __clock_id, struct timespec *__res);
extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp);
extern int clock_nanosleep (clockid_t __clock_id, int __flags,
const struct timespec *__req,
struct timespec *__rem);
extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp);
extern char *ctime (const time_t *__timer);
extern char *ctime_r (const time_t * __restrict __timer,
char * __restrict __buf);
extern double difftime (time_t __time1, time_t __time2);
extern struct tm *getdate (const char *__string);
extern int getdate_r (const char * __restrict __string,
struct tm * __restrict __resbufp);
extern struct tm *gmtime (const time_t *__timer);
extern struct tm *gmtime_r (const time_t * __restrict __timer,
struct tm * __restrict __tp);
extern struct tm *localtime (const time_t *__timer);
extern struct tm *localtime_r (const time_t * __restrict __timer,
struct tm * __restrict __tp);
extern time_t mktime (struct tm *__tp);
extern int nanosleep (const struct timespec *__requested_time,
struct timespec *__remaining);
extern size_t strftime (char * __restrict __s, size_t __maxsize,
const char * __restrict __format,
const struct tm * __restrict __tp);
extern char *strptime (const char * __restrict __s,
const char * __restrict __fmt,
struct tm * __restrict __tp);
extern time_t time (time_t *__timer);
#if 0
extern int timer_create (clockid_t __clock_id,
struct sigevent * __restrict __evp,
timer_t * __restrict __timerid);
extern int timer_delete (timer_t __timerid);
extern int timer_gettime (timer_t __timerid, struct itimerspec *__value);
extern int timer_getoverrun (timer_t __timerid);
extern int timer_settime (timer_t __timerid, int __flags,
const struct itimerspec * __restrict __value,
struct itimerspec * __restrict __ovalue);
#endif
extern void tzset (void);
/*
* Variables.
*/
extern int daylight;
extern long timezone;
extern char *tzname[2];
__END_DECLS
#include <time.h>
#endif /* !_TIME_H */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetC/include/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Makefile.am 21 Aug 2002 23:06:40 -0000 1.5
--- Makefile.am 17 Feb 2003 03:24:44 -0000 1.6
***************
*** 18,21 ****
--- 18,22 ----
string.h \
strings.h \
+ time.h \
unistd.h \
varargs.h
Index: pthread.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetC/include/pthread.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** pthread.h 16 Feb 2003 23:50:22 -0000 1.2
--- pthread.h 17 Feb 2003 03:24:44 -0000 1.3
***************
*** 25,39 ****
#include <features.h>
#include <sys/types.h>
__BEGIN_DECLS
-
- /*
- * This needs to be moved to <time.h> later.
- */
- struct timespec
- {
- long tv_sec;
- long tv_nsec;
- };
/*
--- 25,31 ----
#include <features.h>
#include <sys/types.h>
+ #include <time.h>
__BEGIN_DECLS
/*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetC/include time.h,NONE,1.1 Makefile.am,1.5,1.6 pthread.h,1.2,1.3,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetC/include/sys types.h,1.3,1.4
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetC/libc/time .cvsignore,NONE,1.1 Makefile.am,NONE,1.1 clock.c,NONE,1.1 gmtime.c,NONE,1.1 time-defs.h,NONE,1.1 time-glue.cs,NONE,1.1 time-vars.c,NONE,1.1 time.c,NONE,1.1tzset.c,NONE,1.1
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetC/include/sys types.h,1.3,1.4
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetC/libc/time .cvsignore,NONE,1.1 Makefile.am,NONE,1.1 clock.c,NONE,1.1 gmtime.c,NONE,1.1 time-defs.h,NONE,1.1 time-glue.cs,NONE,1.1 time-vars.c,NONE,1.1 time.c,NONE,1.1tzset.c,NONE,1.1
- Index(es):