home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / libscl / h / time < prev    next >
Encoding:
Text File  |  2006-09-17  |  4.6 KB  |  129 lines

  1. /* time.h standard header for the RISC OS SharedCLibrary.
  2.    Copyright (c) 1997-2005 Nick Burrett
  3.    All rights reserved.
  4.  
  5.    Redistribution and use in source and binary forms, with or without
  6.    modification, are permitted provided that the following conditions
  7.    are met:
  8.    1. Redistributions of source code must retain the above copyright
  9.       notice, this list of conditions and the following disclaimer.
  10.    2. Redistributions in binary form must reproduce the above copyright
  11.       notice, this list of conditions and the following disclaimer in the
  12.       documentation and/or other materials provided with the distribution.
  13.    3. The name of the author may not be used to endorse or promote products
  14.       derived from this software without specific prior written permission.
  15.  
  16.    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17.    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18.    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19.    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20.    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21.    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22.    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23.    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24.    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25.    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  26.  
  27. #ifndef __TIME_H
  28. #define __TIME_H
  29.  
  30. #ifndef __STDDEF_H
  31. #include <stddef.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #ifdef __CLK_TCK
  39. /* Obsolete name for CLOCKS_PER_SEC.  */
  40. #define CLK_TCK __CLK_TCK
  41. /* Number of clock ticks per second measured by the clock function.  */
  42. #define CLOCKS_PER_SEC __CLK_TCK
  43. #else
  44. #define CLK_TCK 100
  45. #define CLOCKS_PER_SEC 100
  46. #endif
  47.  
  48. /* Type of the value returned by the clock() function. Represents
  49.    the number of seconds elapsed since 00:00:00 on January 1, 1970.   */
  50. typedef unsigned int clock_t;
  51.  
  52. /* Returns the elapsed processor time since program execution. */
  53. extern clock_t clock (void);
  54.  
  55. /* Calendar time.  */
  56. typedef unsigned int time_t;
  57.  
  58. struct tm
  59. {
  60.   /* Number of seconds after the minute (0 through 59).  */
  61.   int tm_sec;
  62.   /* Number of minutes after the hour (0 through 59).  */
  63.   int tm_min;
  64.   /* Number of hours past midnight (0 through 23).  */
  65.   int tm_hour;
  66.   /* Day of the month (1 through 31).  */
  67.   int tm_mday;
  68.   /* Number of months since January (0 through 11).  */
  69.   int tm_mon;
  70.   /* Number of years since 1900.  */
  71.   int tm_year;
  72.   /* Number of days since Sunday (0 through 6).  */
  73.   int tm_wday;
  74.   /* Number of days since January 1 (0 through 365).  */
  75.   int tm_yday;
  76.   /* This flag indicates whether Daylight Saving Time is
  77.      (or was, or will be) in effect at the time described.
  78.      The value is positive is DST is in effect, zero if it is not,
  79.      and negative if the information is not available.  */
  80.   int tm_isdst;
  81. };
  82.  
  83. /* Return the number of seconds elapsed between time1 and time0
  84.    as a value of type double.  */
  85. extern double difftime (time_t __time1, time_t __time0);
  86.  
  87. /* Convert a broken-down time structure to a calendar time
  88.    representation.  */
  89. extern time_t mktime (struct tm *__brokentime);
  90.  
  91. /* Return the current time as a value of type time_t.
  92.    If 'result' is non null, then the time will also be stored
  93.    in here.  */
  94. extern time_t time (time_t *__result);
  95.  
  96. /* Convert the broken-down time value that 'brokentime'
  97.    points to into a string in a standard format:
  98.  
  99.      "Sat Mar 22 12:16:34 1997\n".  */
  100. extern char *asctime (const struct tm *__brokentime);
  101.  
  102. /* Similar to asctime() except that the time value is
  103.    specified as a time_t calendar time value.  It is
  104.    equivalent to asctime (localtime (time)).  */
  105. extern char *ctime (const time_t *__time);
  106.  
  107. /* Convert the calendar time pointed to by 'time' to broken-down
  108.    time representation, expressed relative to the user's
  109.    specified time zone.  */
  110. extern struct tm *localtime (const time_t *__time);
  111.  
  112. /* Similar to localtime() except that the broken-down time
  113.    is expressed as GMT, rather than relative to the local time zone.  */
  114. extern struct tm *gmtime (const time_t *__time);
  115.  
  116. /* Similar to the sprintf function but the conversion specifications
  117.    that can appear in the format template 'template' are specialized
  118.    for printing components of the date and time 'brokentime' according
  119.    to the locale currently specified for time conversion.  */
  120. extern size_t strftime (char *__s, size_t __size,
  121.             const char *__templ,
  122.             const struct tm *__brokentime);
  123.  
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127.  
  128. #endif
  129.