diff --git a/twander.py b/twander.py index 7ae2763..523fe25 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.210 2006/12/19 09:12:05 tundra Exp $" +RCSID = "$Id: twander.py,v 3.211 2007/01/02 19:53:29 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -296,6 +296,7 @@ FORCEUNIXPATH = False # Force Unix path separators regardless of OS HIDEDOTFILES = False # Suppress display of files begining with DOTFILE INVERTFILTER = False # Invert wildcard filtering logic +ISODATE = False # Display date/time in ISO 8601 Format MAXMENU = 32 # Maximum length of displayed menu MAXMENUBUF = 250 # Maximum size of internal menu buffer MAXNESTING = 32 # Maximum depth of nested variable definitions @@ -552,6 +553,15 @@ # Constants used with the more usual Unix-style details # Used both by Unix and Win32 when win32all is not present or disabled. + +# Month Name -> Number Conversion Needed For ISO Representation + +ST_MONTHS = {"Jan":"01", "Feb":"02", "Mar":"03", "Apr":"04", + "May":"05", "Jun":"06", "Jul":"07", "Aug":"08", + "Sep":"09", "Oct":"10", "Nov":"11", "Dec":"12" + } + + # Permissions ST_PERMIT = ["---", "--x", "-w-", "-wx", @@ -4637,16 +4647,30 @@ # Get the whole time value ftime = time.ctime(rawtime).split()[1:] - # Pad single-digit dates with leading space + # Pad single-digit dates differently for US vs. ISO + # date representation + + LEADFILL = " " + if ISODATE: + LEADFILL = "0" if len(ftime[1]) == 1: - ftime[1] = " " + ftime[1] + ftime[1] = LEADFILL + ftime[1] # Drop the seconds + ftime[-2] = ":".join(ftime[-2].split(":")[:-1]) - # Turn into a single string - ftime = " ".join(ftime) + # Turn into a single string in either ISO or US format + + if ISODATE: + ftime = "-".join((ftime[3], ST_MONTHS[ftime[0]], ftime[1])) + \ + " " + ftime[2] + + # US Localized Format + + else: + ftime = " ".join(ftime) details += PadString(ftime, ST_SZMTIME) fields.append(rawtime) @@ -5318,6 +5342,7 @@ "FORCEUNIXPATH":FORCEUNIXPATH, "HIDEDOTFILES":HIDEDOTFILES, "INVERTFILTER":INVERTFILTER, + "ISODATE":ISODATE, "NODETAILS":NODETAILS, "NONAVIGATE":NONAVIGATE, "SORTREVERSE":SORTREVERSE,