/[LeafOK_CVS]/pvpgn-1.7.4/src/compat/strftime.c
ViewVC logotype

Contents of /pvpgn-1.7.4/src/compat/strftime.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-csrc
Error occurred while calculating annotation data.
no message

1 /*
2 * Copyright (C) 1999 Ross Combs (rocombs@cs.nmsu.edu)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"
19 #ifndef HAVE_STRFTIME
20
21 #include <stdio.h>
22 #ifdef HAVE_STRING_H
23 # include <string.h>
24 #else
25 # ifdef HAVE_STRINGS_H
26 # include <strings.h>
27 # endif
28 #endif
29 #include "strftime.h"
30 #include "common/setup_after.h"
31
32
33 /* We are not even trying to copy the functionality.
34 We are just trying to get a timestamp. */
35 extern int strftime(char * buf, int bufsize, char const * fmt, struct tm const * tm)
36 {
37 if (!buf || !fmt || !tm)
38 return 0;
39
40 if (bufsize>24)
41 sprintf(buf,"%.4d %.2d %.2d %02.2d:%02.2d:%02.2d",
42 tm->tm_year,
43 tm->tm_mon,
44 tm->tm_mday,
45 tm->tm_hour,
46 tm->tm_min,
47 tm->tm_sec);
48 else if (bufsize>10)
49 sprintf(buf,"%02.2d:%02.2d:%02.2d",
50 tm->tm_hour,
51 tm->tm_min,
52 tm->tm_sec);
53 else
54 buf[0] = '\0';
55
56 return strlen(buf);
57 }
58
59 #else
60 typedef int filenotempty; /* make ISO standard happy */
61 #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1