1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 19:49:27 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Fri Apr 26 12:38:55 MET DST 1996 by Martin Schulze <joey@linux.de>
.\" Translated to German Tue Dec 31 1996 by Patrick Rother <krd@gulu.net>
.\"
.TH CTIME 3 "31. Dezember 1996" "BSD" "Bibliotheksfunktionen"
.SH BEZEICHNUNG
asctime, ctime, gmtime, localtime, mktime \- wandle binäres Datum und Uhrzeit
nach ASCII
.SH ÜBERSICHT
.nf
.B #include <time.h>
.sp
.BI "char *asctime(const struct tm *" timeptr );
.sp
.BI "char *ctime(const time_t *" timep );
.sp
.BI "struct tm *gmtime(const time_t *" timep );
.sp
.BI "struct tm *localtime(const time_t *" timep );
.sp
.BI "time_t mktime(struct tm *" timeptr );
.sp
.BI "extern char *" tzname [2];
.BI "long int " timezone ;
.BI "extern int " daylight ;
.fi
.SH BESCHREIBUNG
Die Funktionen \fBctime()\fP, \fBgmtime()\fP und \fBlocaltime()\fP benötigen
ein Argument des Datentyps \fItime_t\fP, welches die Calendar-Zeit darstellt.
Bei Interpretation als absolute Zeit stellt sie die Anzahl der Sekunden dar,
die seit dem 1. Januar 1970, 00:00.00 Uhr Universalzeit (UTC) verstrichen sind.
.PP
Die Funktionen \fBasctime()\fP und \fBmktime()\fP benötigen beide ein Argument
das eine aufgeteilte Zeitangabe darstellt, d.h. eine binäre Darstellung,
die in Jahr, Monat, Tag usw. aufgeteilt ist. Diese Angaben sind in einer
Struktur \fItm\fP gespeichert, die in \fI<time.h>\fP wie folgt definiert ist:
.sp
.RS
.nf
.ne 12
.ta 8n 16n 32n
struct tm
{
int tm_sec; /* Sekunden */
int tm_min; /* Minuten */
int tm_hour; /* Stunden */
int tm_mday; /* Monatstag */
int tm_mon; /* Monat */
int tm_year; /* Jahr */
int tm_wday; /* Wochentag */
int tm_yday; /* Jahrestag */
int tm_isdst; /* Sommerzeit */
};
.ta
.fi
.RE
.PP
Die Elemente der Struktur \fItm\fP sind:
.TP
.I tm_sec
Die Anzahl der Sekunden nach der vollen Minute, normalerweise im Bereich 0 bis 59,
jedoch in Ausnahmefällen bis 61 um Schaltsekunden zu erlauben.
.TP
.I tm_min
Die Anzahl der Minuten nach der vollen Stunde, im Bereich 0 bis 59.
.TP
.I tm_hour
Die Anzahl der Stunden nach Mitternacht, im Bereich 0 bis 23.
.TP
.I tm_mday
Der Tag im Monat, im Bereich 1 bis 31.
.TP
.I tm_mon
Die Anzahl der Monate seit Januar, im Bereich 0 bis 11.
.TP
.I tm_year
Die Anzahl der Jahre nach 1900.
.TP
.I tm_wday
Die Anzahl der Tag seit Sonntag, im Bereich 0 bis 6.
.TP
.I tm_yday
Die Anzahl der Tage seit dem 1. Januar, im Bereich 0 bis 365.
.TP
.I tm_isdst
Ein Flag das anzeigt ob Sommerzeit herrscht für die angegebene Zeit.
Der Wert ist positiv wenn Sommerzeit herrscht, Null wenn nicht, und negativ
wenn die Information nicht verfügbar ist.
.PP
Die Funktion \fBctime()\fP wandelt die Calendar-Zeit \fItimep\fP in einen
String der Form
.sp
.RS
"Wed Jun 30 21:49:08 1993\\n"
.RE
.sp
Die Abkürzungen für die Wochentage sind `Sun', `Mon', `Tue', `Wed',
`Thu', `Fri', und `Sat'. Die Abkürzungen für die Monate sind `Jan',
`Feb', `Mar', `Apr', `May', `Jun', `Jul', `Aug', `Sep', `Oct', `Nov', und
`Dec'. Der Rückgabewert zeigt auf einen statisch belegten String welcher
durch nachfolgende Aufrufe von Datums-/Uhrzeitfunktionen überschrieben werden
darf. Die Funktion setzt auch die externe Variable \fItzname\fP mit
Informationen über die aktuelle Zeitzone.
.PP
Die Funktion \fBgmtime()\fP wandelt die Calendar-Zeit \fItimep\fP in eine
aufgeteilte Zeitangabe, ausgedrückt in Universalzeit (UTC).
.PP
Die Funktion \fBlocaltime()\fP wandelt die Calendar-Zeit \fItimep\fP in
eine aufgeteilte Zeitangabe, ausgedrückt relativ zu der Benutzerspezifizierten
Zeitzone. Die Funktion setzt auch die externe Variable \fItzname\fP mit
Informationen über die aktuelle Zeitzone, \fItimezone\fP mit der Differenz
zwischen Universalzeit (UTC) und der lokalen Standardzeit in Sekunden,
sowie \fIdaylight\fP auf einen Nicht-Null-Wert wenn
Standard-US-Sommerzeitregeln greifen.
.PP
Die Funktion \fBasctime()\fP wandelt die aufgeteilte Zeitangabe \fItimeptr\fP
in einen String mit dem gleichen Format wie \fBctime()\fP.
Der Rückgabewert zeigt auf einen statisch belegten String welcher durch
nachfolgende Aufrufe von Datums-/Uhrzeitfunktionen überschrieben werden darf.
.PP
Die Funktion \fBmktime()\fP wandelt die aufgeteilte Zeitangabe, ausgedrückt
als lokale Zeit, in Calendar-Zeit. Die Funktion ignoriert die Inhalte
der Strukturelemente \fItm_wday\fP und \fItm_yday\fP und berechnet sie neu
aus den anderen Informationen der Struktur für die aufgeteilte Zeitangabe.
Aufrufen von \fBmktime()\fP setzt auch die externe Variable \fItzname\fP
mit Informationen über die aktuelle Zeitzone. Wenn die angegebene
aufgeteilte Zeitangabe nicht als Calendar-Zeit dargestellt werden kann
gibt \fBmktime()\fP den Wert (time_t)(\-1) zurück und verändert die Elemente
\fItm_wday\fP und \fItm_yday\fP der aufgeteilten Zeitangabe nicht.
.SH "KONFORM ZU"
SVID 3, POSIX, BSD 4.3, ISO 9899
.SH "SIEHE AUCH"
.BR date (1),
.BR gettimeofday (2),
.BR time (2),
.BR tzset (3),
.BR difftime (3),
.BR strftime (3),
.BR newctime (3).
|