time.h

Go to the documentation of this file.
00001 /*****************************************************************************************
00002  Copyright (c) 2002-2004 The UbixOS Project
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without modification, are
00006  permitted provided that the following conditions are met:
00007 
00008  Redistributions of source code must retain the above copyright notice, this list of
00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
00010  form must reproduce the above copyright notice, this list of conditions, the following
00011  disclaimer and the list of authors in the documentation and/or other materials provided
00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
00013  contributors may be used to endorse or promote products derived from this software
00014  without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026  $Id: time_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
00027 
00028 *****************************************************************************************/
00029 
00030 #ifndef _TIME_H
00031 #define _TIME_H
00032 
00033 #include <ubixos/types.h>
00034 #include <sys/io.h>
00035 
00036 typedef long suseconds_t;
00037 
00038 #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
00039 
00040 #define MINUTE 60
00041 #define HOUR (60*MINUTE)
00042 #define DAY (24*HOUR)
00043 #define YEAR (365*DAY)
00044 
00045 #ifndef _TIME_T_DECLARED
00046 typedef __time_t        time_t;
00047 #define _TIME_T_DECLARED
00048 #endif
00049 
00050 struct timespec {
00051         time_t  tv_sec;         /* seconds */
00052         long    tv_nsec;        /* and nanoseconds */
00053 };
00054 
00055 
00056 
00057 struct timeStruct {
00058   int sec;
00059   int min;
00060   int hour;
00061   int day;
00062   int mon;
00063   int year;
00064   };
00065 
00066 
00067 struct timezone {
00068   int     tz_minuteswest; /* minutes west of Greenwich */
00069   int     tz_dsttime;     /* type of dst correction */
00070   };
00071 
00072 struct timeval {
00073   long            tv_sec;         /* seconds (XXX should be time_t) */
00074   suseconds_t     tv_usec;        /* and microseconds */
00075   };
00076 
00077 int gettimeofday(struct timeval *tp,struct timezone *tzp);
00078 
00079 
00080 
00081 int time_init();
00082 uInt32 timeMake(struct timeStruct *time);
00083 
00084 #endif
00085 
00086 /***
00087  $Log: time_8h-source.html,v $
00087  Revision 1.7  2006/12/15 17:47:07  reddawg
00087  Updates
00087 
00088  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
00089  ubix2
00090 
00091  Revision 1.2  2005/10/12 00:13:37  reddawg
00092  Removed
00093 
00094  Revision 1.1.1.1  2005/09/26 17:23:56  reddawg
00095  no message
00096 
00097  Revision 1.4  2004/07/09 13:37:30  reddawg
00098  time: timeInit to time_init
00099  Adjusted initialization routines
00100 
00101  Revision 1.3  2004/06/29 11:41:44  reddawg
00102  Fixed some global variables
00103 
00104  Revision 1.2  2004/05/21 15:20:00  reddawg
00105  Cleaned up
00106 
00107  END
00108  ***/

Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by  doxygen 1.4.7