[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/FTP - OSEmulators.py:1.1.4.4

Shane Hathaway shane@cvs.zope.org
Wed, 24 Apr 2002 17:08:58 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Server/FTP
In directory cvs.zope.org:/tmp/cvs-serv14426

Modified Files:
      Tag: Zope-3x-branch
	OSEmulators.py 
Log Message:
Minor formatting corrections in "ls" emulation


=== Zope3/lib/python/Zope/Server/FTP/OSEmulators.py 1.1.4.3 => 1.1.4.4 ===
 
 def ls_date (now, t):
-    """Emulate the 'ls' command's date field.  it has two formats
-       - if the date is more than 180 days in the past, then it's like
-       this: Oct 19 1995 otherwise, it looks like this: Oct 19 17:33
+    """Emulate the 'ls' command's date field.  It has two formats.
+       If the date is more than 180 days in the past or future, then
+       it's like this:
+         Oct 19  1995
+       otherwise, it looks like this:
+         Oct 19 17:33
     """
     try:
-        info = time.gmtime(t)
+        info = time.localtime(t)
     except:
-        info = time.gmtime(0)
+        info = time.localtime(0)
 
     # 15,600,000 == 86,400 * 180
-    if (now - t) > 15600000:
-        return '%s %2d  %d' % (
+    if abs((now - t) > 15600000):
+        return '%s %2d %5d' % (
                 months[info[1]-1],
                 info[2],
                 info[0]