diff -ru libmimms.orig/core.py libmimms/core.py
--- libmimms.orig/core.py	2008-05-12 02:55:38.000000000 +0200
+++ libmimms/core.py	2009-07-12 17:54:33.000000000 +0200
@@ -26,6 +26,7 @@
 
 from optparse import OptionParser
 from time import time
+from datetime import datetime
 from urlparse import urlparse
 
 from . import libmms
@@ -74,6 +75,11 @@
   s = seconds % 60
   return "%02d:%02d:%02d" % (h, m ,s)
 
+UNIX_T0 = datetime(1970, 1, 1)
+def datetime_to_timestamp(datetime):
+  delta = datetime - UNIX_T0
+  return delta.days * 86400 + delta.seconds + delta.microseconds / 1e6
+
 def get_filename(options):
   "Based on program options, choose an appropriate filename."
 
@@ -126,59 +132,64 @@
   bytes_in_duration = 0
   bytes_per_second  = 0
 
-  for data in stream:
-    f.write(data)
-
-    # keep track of the number of bytes handled in the current duration
-    bytes_in_duration += len(data)
-
-    # every duration, update progress bar
-    if duration_timer.elapsed() >= 1:
-
-      # calculate a weighted average over 10 durations
-      bytes_per_second *= 9;
-      bytes_per_second += bytes_in_duration / duration_timer.restart()
-      bytes_per_second /= 10.0
-
-      # reset the byte counter to prepare for the next duration
-      bytes_in_duration = 0
-
-      # estimate the number of seconds remaining
-      bytes_remaining = stream.length() - stream.position()
-      seconds_remaining = bytes_remaining / bytes_per_second
-
-      # if the stream has no duration, then we can't tell the stream length
-      # or estimate the download time remaining
-      # TODO: is this always true? is duration 0 iff length is undefined?
-      if stream.duration():
-        length    = stream.length()
-        remaining = seconds_remaining
-      else:
-        length    = -1
-        remaining = -1
-
-      # if we are running with a user-defined timeout, we always have an
-      # upper bound on how much time is remaining
-      if options.time:
-        if remaining < 0 or options.time < remaining:
-          remaining = options.time*60 - timeout_timer.elapsed()
-
-      clear = " " * len(status)
-      status = "%s / %s (%s/s, %s remaining)" % (
-        bytes_to_string(stream.position()),
-        bytes_to_string(length),
-        bytes_to_string(bytes_per_second),
-        seconds_to_string(remaining)
-        )
-
-      if not options.quiet: print "\r", clear, "\r", status,
-      sys.stdout.flush()
-
-      if options.time and timeout_timer.elapsed() > (options.time*60):
-        raise Timeout
+  try:
+    for data in stream:
+      f.write(data)
+  
+      # keep track of the number of bytes handled in the current duration
+      bytes_in_duration += len(data)
+  
+      # every duration, update progress bar
+      if duration_timer.elapsed() >= 1:
+  
+        # calculate a weighted average over 10 durations
+        bytes_per_second *= 9;
+        bytes_per_second += bytes_in_duration / duration_timer.restart()
+        bytes_per_second /= 10.0
+  
+        # reset the byte counter to prepare for the next duration
+        bytes_in_duration = 0
+  
+        # estimate the number of seconds remaining
+        bytes_remaining = stream.length() - stream.position()
+        seconds_remaining = bytes_remaining / bytes_per_second
+  
+        # if the stream has no duration, then we can't tell the stream length
+        # or estimate the download time remaining
+        # TODO: is this always true? is duration 0 iff length is undefined?
+        if stream.duration():
+          length    = stream.length()
+          remaining = seconds_remaining
+        else:
+          length    = -1
+          remaining = -1
+  
+        # if we are running with a user-defined timeout, we always have an
+        # upper bound on how much time is remaining
+        if options.time:
+          if remaining < 0 or options.time < remaining:
+            remaining = options.time*60 - timeout_timer.elapsed()
+  
+        clear = " " * len(status)
+        status = "%s / %s (%s/s, %s remaining)" % (
+          bytes_to_string(stream.position()),
+          bytes_to_string(length),
+          bytes_to_string(bytes_per_second),
+          seconds_to_string(remaining)
+          )
+  
+        if not options.quiet: print "\r", clear, "\r", status,
+        sys.stdout.flush()
+  
+        if options.time and timeout_timer.elapsed() > (options.time*60):
+          raise Timeout
 
-  f.close()
-  stream.close()
+  finally:
+    f.close()
+    if stream.duration():
+      mtime = datetime_to_timestamp(stream.datetime())
+      os.utime(filename, (mtime, mtime))
+    stream.close()
 
 def run(argv):
   "Run the main mimms program with the given command-line arguments."
@@ -202,7 +213,7 @@
     help="the desired bandwidth for stream selection in BANDWIDTH bytes/s")
   parser.add_option(
     "-t", "--time",
-    type="int", dest="time",
+    type="float", dest="time",
     help="stop downloading after TIME minutes")
   parser.add_option(
     "-v", "--verbose",
diff -ru libmimms.orig/libmms.py libmimms/libmms.py
--- libmimms.orig/libmms.py	2008-05-12 02:55:38.000000000 +0200
+++ libmimms/libmms.py	2009-07-12 00:31:28.000000000 +0200
@@ -32,7 +32,10 @@
 libmms.mmsx_close.argtypes = [c_void_p]
 libmms.mmsx_close.restype = None
 
-# querying length and position
+# querying creation time, length and position
+libmms.mmsx_get_file_time.argtypes = [c_void_p]
+libmms.mmsx_get_file_time.restype = c_ulonglong
+
 libmms.mmsx_get_current_pos.argtypes = [c_void_p]
 libmms.mmsx_get_current_pos.restype = c_longlong
 
@@ -56,6 +59,12 @@
 libmms.mmsx_read.argtypes = [c_void_p, c_void_p, c_char_p, c_int]
 libmms.mmsx_read.restype = c_int
 
+import datetime
+
+_FILETIME_null_date = datetime.datetime(1601, 1, 1, 0, 0, 0)
+def FiletimeToDateTime(timestamp):
+  return _FILETIME_null_date + datetime.timedelta(microseconds=timestamp/10)
+
 class Error(Exception):
   "Encapsulates a libmms error."
   pass
@@ -81,6 +90,10 @@
     "Return the duration of the stream, in (fractional) seconds."
     return libmms.mmsx_get_time_length(self.mms)
 
+  def datetime(self):
+    "Return the creation date and time of the stream, as a datetime object."
+    return FiletimeToDateTime(libmms.mmsx_get_file_time(self.mms))
+
   def seekable(self):
     "Return whether or not the stream is seekable."
     return libmms.mmsx_get_seekable(self.mms)
