1.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. 2.\" 3.\" This documentation was written by Ed Maste under sponsorship of 4.\" the FreeBSD Foundation. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" This software is provided by the author and contributors ``as is'' and 16.\" any express or implied warranties, including, but not limited to, the 17.\" implied warranties of merchantability and fitness for a particular purpose 18.\" are disclaimed. In no event shall the author or contributors be liable 19.\" for any direct, indirect, incidental, special, exemplary, or consequential 20.\" damages (including, but not limited to, procurement of substitute goods 21.\" or services; loss of use, data, or profits; or business interruption) 22.\" however caused and on any theory of liability, whether in contract, strict 23.\" liability, or tort (including negligence or otherwise) arising in any way 24.\" out of the use of this software, even if advised of the possibility of 25.\" such damage. 26.\" 27.\" $Id$ 28.\" 29.Dd August 24, 2016 30.Dt ELFTC_TIMESTAMP 3 31.Os 32.Sh NAME 33.Nm elftc_timestamp 34.Nd return the current or environment-provided timestamp 35.Sh LIBRARY 36.Lb libelftc 37.Sh SYNOPSIS 38.In libelftc.h 39.Ft int 40.Fo elftc_timestamp 41.Fa "time_t *timestamp" 42.Fc 43.Sh DESCRIPTION 44The 45.Fn elftc_timestamp 46function returns a timestamp supplied by the 47.Ev SOURCE_DATE_EPOCH 48environment variable, or the current time provided by 49.Xr time 3 50if the environment variable is not set. 51.Pp 52The 53.Ar timestamp 54argument specifies a pointer to the location where the timestamp will be 55stored. 56.Sh RETURN VALUES 57Function 58.Fn elftc_timestamp 59returns 0 on success, and -1 in the event of an error. 60.Sh ERRORS 61The 62.Fn elftc_timestamp 63function may fail with the following errors: 64.Bl -tag -width ".Bq Er ERANGE" 65.It Bq Er EINVAL 66.Ev SOURCE_DATE_EPOCH 67contains invalid characters. 68.It Bq Er ERANGE 69.Ev SOURCE_DATE_EPOCH 70specifies a negative value or a value that cannot be stored in a 71time_t. 72.El 73The 74.Fn elftc_timestamp 75function may also fail for any of the reasons described in 76.Xr strtoll 3 . 77.Sh SEE ALSO 78.Xr strtoll 3 , 79.Xr time 3 80