X-Git-Url: https://git.distorted.org.uk/~mdw/misc/blobdiff_plain/0f581568f662310ff4a32e3d43016fff268d10bd..300a556d392d9bd6ac5b98c1b4b2d0a052459053:/timemax.cc diff --git a/timemax.cc b/timemax.cc new file mode 100644 index 0000000..f02cba5 --- /dev/null +++ b/timemax.cc @@ -0,0 +1,49 @@ +/* -*-c++-*- + * + * Return the largest allowable time_t value + * + * (c) 2016 Mark Wooding + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/*----- Header files ------------------------------------------------------*/ + +#include +#include + +#include "timemax.h" + +using namespace std; + +/*----- Main code ---------------------------------------------------------*/ + +/* --- @timemax@ --- * + * + * Arguments: --- + * + * Returns: The largest value repesentable in an object of type @time_t@. + * + * Use: For some stupid reason there isn't a @TIME_MAX@ anywhere, and + * it's really hard to discover the right value in C. But it's + * quite easy in C++, so that's what we do. + */ + +time_t timemax() { return numeric_limits::max(); } + +/*----- That's all, folks -------------------------------------------------*/