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
|
/* $Id: jump.cpp,v 1.6 2003/07/03 15:18:17 terpstra Exp $
*
* jump.cpp - Jump to a given date offset
*
* Copyright (C) 2002 - Wesley W. Terpstra
*
* License: GPL
*
* Authors: 'Wesley W. Terpstra' <wesley@terpstra.ca>
*
* 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; version 2.
*
* 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
*/
#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64
#include "parse.h"
#include <ctime>
#include <cstring>
int main()
{
map<string, string> args = getParams();
struct tm tms;
memset(&tms, 0, sizeof(tms));
tms.tm_sec = atol(args["sec" ].c_str());
tms.tm_min = atol(args["min" ].c_str());
tms.tm_hour = atol(args["hour"].c_str());
tms.tm_mday = atol(args["mday"].c_str());
tms.tm_mon = atol(args["mon" ].c_str()) - 1;
tms.tm_year = atol(args["year"].c_str()) - 1900;
time_t utc = atol(args["utc"].c_str());
if (utc) tms = *gmtime(&utc);
char buf[26];
strftime(buf, 25, "%Y%m%d.%H%M%S", &tms);
return redirectUrl(
args["doc-url"] +
"/mindex/" +
args["list"] +
"@" +
buf +
".00000000." +
args["format"]);
}
|