| 1 |
'\" t |
| 2 |
.\" Title: function::ctime |
| 3 |
.\" Author: |
| 4 |
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> |
| 5 |
.\" Date: October 2025 |
| 6 |
.\" Manual: Time utility functions |
| 7 |
.\" Source: SystemTap Tapset Reference |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "FUNCTION::CTIME" "3stap" "October 2025" "SystemTap Tapset Reference" "Time utility functions" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
function::ctime \- Convert seconds since epoch into human readable date/time string |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
.nf |
| 35 |
1) ctime:string(epochsecs:long) |
| 36 |
.fi |
| 37 |
.sp |
| 38 |
.nf |
| 39 |
2) ctime:string() |
| 40 |
.fi |
| 41 |
.SH "ARGUMENTS" |
| 42 |
.PP |
| 43 |
\fIepochsecs\fR |
| 44 |
.RS 4 |
| 45 |
Number of seconds since epoch (as returned by |
| 46 |
\fBgettimeofday_s\fR) |
| 47 |
.RE |
| 48 |
.SH "DESCRIPTION" |
| 49 |
.PP |
| 50 |
1) Takes an argument of seconds since the epoch as returned by\fBgettimeofday_s\fR\&. Returns a string of the form |
| 51 |
.PP |
| 52 |
2) |
| 53 |
\(lqWed Jun 30 21:49:08 1993\(rq |
| 54 |
.PP |
| 55 |
The string will always be exactly 24 characters\&. If the time would be unreasonable far in the past (before what can be represented with a 32 bit offset in seconds from the epoch) an error will occur (which can be avoided with try/catch)\&. If the time would be unreasonable far in the future, an error will also occur\&. |
| 56 |
.PP |
| 57 |
Note that the epoch (zero) corresponds to |
| 58 |
.PP |
| 59 |
\(lqThu Jan 1 00:00:00 1970\(rq |
| 60 |
.PP |
| 61 |
The earliest full date given by ctime, corresponding to epochsecs \-2147483648 is |
| 62 |
\(lqFri Dec 13 20:45:52 1901\(rq\&. The latest full date given by ctime, corresponding to epochsecs 2147483647 is |
| 63 |
\(lqTue Jan 19 03:14:07 2038\(rq\&. |
| 64 |
.PP |
| 65 |
The abbreviations for the days of the week are \(oqSun\(cq, \(oqMon\(cq, \(oqTue\(cq, \(oqWed\(cq, \(oqThu\(cq, \(oqFri\(cq, and \(oqSat\(cq\&. The abbreviations for the months are \(oqJan\(cq, \(oqFeb\(cq, \(oqMar\(cq, \(oqApr\(cq, \(oqMay\(cq, \(oqJun\(cq, \(oqJul\(cq, \(oqAug\(cq, \(oqSep\(cq, \(oqOct\(cq, \(oqNov\(cq, and \(oqDec\(cq\&. |
| 66 |
.PP |
| 67 |
Note that the real C library |
| 68 |
\fBctime\fR |
| 69 |
function puts a newline (\*(Aq\en\*(Aq) character at the end of the string that this function does not\&. Also note that since the kernel has no concept of timezones, the returned time is always in GMT\&. |
| 70 |
.PP |
| 71 |
|
| 72 |
.SH SEE ALSO\n |
| 73 |
.IR tapset::ctime (3stap) |