Index: src/org/jruby/RubyTime.java
===================================================================
--- src/org/jruby/RubyTime.java	(revision 8823)
+++ src/org/jruby/RubyTime.java	(working copy)
@@ -21,6 +21,7 @@
  * Copyright (C) 2006 Thomas E Enebo <enebo@acm.org>
  * Copyright (C) 2006 Ola Bini <ola.bini@ki.se>
  * Copyright (C) 2006 Miguel Covarrubias <mlcovarrubias@gmail.com>
+ * Copyright (C) 2009 Joseph LaFata <joe@quibb.org>
  * 
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
@@ -552,10 +553,11 @@
 
     public RubyObject mdump(final IRubyObject[] args) {
         RubyTime obj = (RubyTime)args[0];
-        DateTime dateTime = obj.dt.withZone(DateTimeZone.UTC);
+        DateTime dateTime = obj.dt;
         byte dumpValue[] = new byte[8];
         int pe = 
             0x1                                 << 31 |
+            ((obj.gmt().isTrue())? 0x1 : 0x0)   << 30 |
             (dateTime.getYear()-1900)           << 14 |
             (dateTime.getMonthOfYear()-1)       << 10 |
             dateTime.getDayOfMonth()            << 5  |
@@ -682,7 +684,7 @@
     protected static RubyTime s_mload(IRubyObject recv, RubyTime time, IRubyObject from) {
         Ruby runtime = recv.getRuntime();
 
-        DateTime dt = new DateTime(DateTimeZone.UTC);
+        DateTime dt = new DateTime(getLocalTimeZone(runtime));
 
         byte[] fromAsBytes = null;
         fromAsBytes = from.convertToString().getBytes();
@@ -698,9 +700,11 @@
             s |= ((int)fromAsBytes[i] & 0xFF) << (8 * (i - 4));
         }
         if ((p & (1<<31)) == 0) {
-            dt = dt.withMillis(p * 1000L + s);
+            dt = dt.withMillis(p * 1000L);
+            time.setUSec((s & 0xFFFFF) % 1000);
         } else {
             p &= ~(1<<31);
+            if((p >>> 30 & 0x1) == 0x1) dt = dt.withZone(DateTimeZone.UTC);
             dt = dt.withYear(((p >>> 14) & 0xFFFF) + 1900);
             dt = dt.withMonthOfYear(((p >>> 10) & 0xF) + 1);
             dt = dt.withDayOfMonth(((p >>> 5)  & 0x1F));
@@ -709,7 +713,6 @@
             dt = dt.withSecondOfMinute(((s >>> 20) & 0x3F));
             // marsaling dumps usec, not msec
             dt = dt.withMillisOfSecond((s & 0xFFFFF) / 1000);
-            dt = dt.withZone(getLocalTimeZone(runtime));
             time.setUSec((s & 0xFFFFF) % 1000);
         }
         time.setDateTime(dt);
Index: test/testMarshal.rb
===================================================================
--- test/testMarshal.rb	(revision 8823)
+++ test/testMarshal.rb	(working copy)
@@ -405,7 +405,7 @@
 test_exception(TypeError) { Marshal.dump(Thread.new {}) }
 
 # time marshalling
-unpacked_marshaled_time = [4, 8, 117, 58, 9, 84, 105, 109, 101, 13, 247, 239, 26, 128, 57, 48, 112, 57]
+unpacked_marshaled_time = [4, 8, 117, 58, 9, 84, 105, 109, 101, 13, 247, 239, 26, 192, 57, 48, 112, 57]
 actual_time = Time.utc(2007, 12, 31, 23, 14, 23, 12345)
 test_equal(
   unpacked_marshaled_time,

