Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 42 lines (36 sloc) 1.236 kB
c663920 @pajamian Fix incorrect license in headers GPL v2 -> GPL v2 "or later". Update…
pajamian authored
1 # Copyright 2002-2007 Interchange Development Group and others
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
7 #
8 # $Id: db_date.tag,v 1.4 2007-03-30 23:40:56 pajamian Exp $
cdb2d3e @docelic Header/license fix or Version update+minor formatting fix, or both
docelic authored
9
8f219b4 @perusionmike * The great tag breakout!
perusionmike authored
10 # [db-date table format]
11 #
12 # This tag returns the last-modified time of a database table,
13 # 'products' by default. Accepts a POSIX strftime value for
14 # date format; uses '%A %d %b %Y' by default.
15 #
cdb2d3e @docelic Header/license fix or Version update+minor formatting fix, or both
docelic authored
16 UserTag db-date Order table format
8f219b4 @perusionmike * The great tag breakout!
perusionmike authored
17 UserTag db-date PosNumber 2
c663920 @pajamian Fix incorrect license in headers GPL v2 -> GPL v2 "or later". Update…
pajamian authored
18 UserTag db-date Version $Revision: 1.4 $
cdb2d3e @docelic Header/license fix or Version update+minor formatting fix, or both
docelic authored
19 UserTag db-date Routine <<EOF
8f219b4 @perusionmike * The great tag breakout!
perusionmike authored
20 sub {
21 my ($db, $format) = @_;
22 my ($dbfile, $mtime);
23
24 # use defaults if necessary
25 $db = 'products' unless $db;
26 $format = '%A %d %b %Y' unless $format;
27
28 # build database file name
29 $dbfile = $Vend::Cfg->{ProductDir} . '/'
30 . $Vend::Cfg->{Database}{$db}{'file'};
31
32 # get last modified time
33 $mtime = (stat ($dbfile))[9];
34
35 if (defined ($mtime)) {
36 return POSIX::strftime($format, localtime($mtime));
37 } else {
38 logError ("Couldn't stat $dbfile: $!\n");
39 }
40 }
41 EOF
Something went wrong with that request. Please try again.