Index: /branches/anuga_1_2_0/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py	(revision 8069)
@@ -62,4 +62,5 @@
                        full_send_dict=None,
                        ghost_recv_dict=None,
+                       starttime=0.0,
                        processor=0,
                        numproc=1,
@@ -253,6 +254,6 @@
         self.finaltime = None
         self.recorded_min_timestep = self.recorded_max_timestep = 0.0
-        self.starttime = 0 # Physical starttime if any
-                           # (0 is 1 Jan 1970 00:00:00)
+        self.starttime = starttime # Physical starttime if any
+        self.time = self.starttime 
         self.timestep = 0.0
         self.flux_timestep = 0.0
@@ -496,5 +497,13 @@
         """Get the absolute model time (seconds)."""
 
-        return self.time + self.starttime
+        return self.time
+
+    ##
+    # @brief Get current timestep.
+    # @return The curent timestep (seconds).
+    def get_timestep(self):
+        """et current timestep (seconds)."""
+
+        return self.timestep
 
     ##
@@ -1213,6 +1222,6 @@
         # Observe time interval restriction if any
         if self.monitor_time_interval is not None and\
-               (self.time < self.monitor_time_interval[0] or\
-               self.time > self.monitor_time_interval[1]):
+               (self.get_time() < self.monitor_time_interval[0] or\
+               self.get_time() > self.monitor_time_interval[1]):
             return
 
@@ -1237,5 +1246,5 @@
                 maxloc = Q.get_maximum_location()
                 info_block['max_location'] = maxloc
-                info_block['max_time'] = self.time
+                info_block['max_time'] = self.get_time()
 
             # Update minimum
@@ -1246,5 +1255,5 @@
                 minloc = Q.get_minimum_location()
                 info_block['min_location'] = minloc
-                info_block['min_time'] = self.time
+                info_block['min_time'] = self.get_time()
 
     ##
@@ -1364,4 +1373,6 @@
     def set_starttime(self, time):
         self.starttime = float(time)
+        self.set_time(self.starttime)
+        
 
 ################################################################################
@@ -1415,5 +1426,8 @@
                    % self.get_boundary_tags())
         assert hasattr(self, 'boundary_objects'), msg
-
+        
+        if self.get_time() != self.get_starttime():
+            self.set_time(self.get_starttime())
+        
         if yieldstep is None:
             yieldstep = self.evolve_max_timestep
@@ -1423,4 +1437,6 @@
         self._order_ = self.default_order
 
+        assert finaltime > self.get_starttime(), 'finaltime is less than starttime!'
+        
         if finaltime is not None and duration is not None:
             msg = 'Only one of finaltime and duration may be specified'
@@ -1433,5 +1449,5 @@
 
         N = len(self)                             # Number of triangles
-        self.yieldtime = self.time + yieldstep    # set next yield time
+        self.yieldtime = self.get_time() + yieldstep    # set next yield time
 
         # Initialise interval of timestep sizes (for reporting only)
@@ -1458,16 +1474,18 @@
 
         if skip_initial_step is False:
-            yield(self.time)      # Yield initial values
+            yield(self.get_time())      # Yield initial values
 
         while True:
-            # Evolve One Step, using appropriate timestepping method
+
+            initial_time = self.get_time()
+
             if self.get_timestepping_method() == 'euler':
-                self.evolve_one_euler_step(yieldstep, finaltime)
+                self.evolve_one_euler_step(yieldstep, self.finaltime)
 
             elif self.get_timestepping_method() == 'rk2':
-                self.evolve_one_rk2_step(yieldstep, finaltime)
+                self.evolve_one_rk2_step(yieldstep, self.finaltime)
 
             elif self.get_timestepping_method() == 'rk3':
-                self.evolve_one_rk3_step(yieldstep, finaltime)
+                self.evolve_one_rk3_step(yieldstep, self.finaltime)
 
             # Update extrema if necessary (for reporting)
@@ -1479,20 +1497,20 @@
 
             # Yield results
-            if finaltime is not None and self.time >= finaltime-epsilon:
-                if self.time > finaltime:
+            if self.finaltime is not None and self.get_time() >= self.finaltime-epsilon:
+                
+                if self.get_time() > self.finaltime:
                     # FIXME (Ole, 30 April 2006): Do we need this check?
                     # Probably not (Ole, 18 September 2008).
                     # Now changed to Exception.
-                    msg = ('WARNING (domain.py): time overshot finaltime. '
-                           'Contact Ole.Nielsen@ga.gov.au')
+                    msg = ('WARNING (domain.py): time overshot finaltime. ')
                     raise Exception, msg
 
-                # Yield final time and stop
-                self.time = finaltime
-                yield(self.time)
+                # Log and then Yield final time and stop
+                self.set_time(self.finaltime)
+                yield(self.get_time())
                 break
 
             # if we are at the next yield point
-            if self.time >= self.yieldtime:
+            if self.get_time() >= self.yieldtime:
                 # Yield (intermediate) time and allow inspection of domain
                 if self.checkpoint is True:
@@ -1500,6 +1518,6 @@
                     self.delete_old_checkpoints()
 
-                # Pass control on to outer loop for more specific actions
-                yield(self.time)
+                # Log and then Pass control on to outer loop for more specific actions
+                yield(self.get_time())
 
                 # Reinitialise
@@ -1578,5 +1596,5 @@
 
         # Update time
-        self.time += self.timestep
+        self.set_time(self.get_time() + self.timestep)
 
         # Update vertex and edge values
@@ -1632,5 +1650,5 @@
         self.backup_conserved_quantities()
 
-        initial_time = self.time
+        initial_time = self.get_time()
 
         ######
@@ -1654,5 +1672,5 @@
 
         # Update time
-        self.time += self.timestep
+        self.set_time(self.time + self.timestep)
 
         # Update vertex and edge values
@@ -1690,5 +1708,5 @@
 
         # Set substep time
-        self.time = initial_time + self.timestep*0.5
+        self.set_time(initial_time + self.timestep*0.5)
 
         # Update vertex and edge values
@@ -1723,5 +1741,5 @@
 
         # Set new time
-        self.time = initial_time + self.timestep
+        self.set_time(initial_time + self.timestep)
 
         # Update vertex and edge values
@@ -1875,10 +1893,10 @@
 
         # Ensure that final time is not exceeded
-        if finaltime is not None and self.time + timestep > finaltime :
-            timestep = finaltime-self.time
+        if finaltime is not None and self.get_time() + timestep > finaltime :
+            timestep = finaltime - self.get_time()
 
         # Ensure that model time is aligned with yieldsteps
-        if self.time + timestep > self.yieldtime:
-            timestep = self.yieldtime - self.time
+        if self.get_time() + timestep > self.yieldtime:
+            timestep = self.yieldtime - self.get_time()
 
         self.timestep = timestep
@@ -2009,5 +2027,5 @@
             for i in range(self.number_of_full_triangles):
                 if self.max_speed[i] > bins[-1]:
-                    msg = 'Time=%f: Ignoring isolated high ' % self.time
+                    msg = 'Time=%f: Ignoring isolated high ' % self.get_time()
                     msg += 'speed triangle '
                     msg += '#%d of %d with max speed=%f' \
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/abstract_2d_finite_volumes/test_gauge.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/abstract_2d_finite_volumes/test_gauge.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/abstract_2d_finite_volumes/test_gauge.py	(revision 8069)
@@ -84,11 +84,11 @@
             os.remove(self.sww.filename)
 
-    def _create_sww(self):
+    def _create_sww(self,stage=10.0, timestep=2.0):
         self.sww = SWW_file(self.domain)
         self.sww.store_connectivity()
         self.sww.store_timestep()
-        self.domain.set_quantity('stage', 10.0) # This is automatically limited
+        self.domain.set_quantity('stage', stage) # This is automatically limited
         # so it will not be less than the elevation
-        self.domain.time = 2.
+        self.domain.set_time(self.domain.get_time()-self.domain.starttime+timestep)
         self.sww.store_timestep()
         
@@ -245,6 +245,7 @@
         
         domain = self.domain
-        domain.set_starttime(5)
-        self._create_sww()
+        domain.set_starttime(1)
+        
+        self._create_sww(timestep=2)
         
         # test the function
@@ -258,5 +259,5 @@
 point2, 0.5, 2.0, 9.0\n")
         file_id.close()
-
+        
         sww2csv_gauges(self.sww.filename, 
                             points_file,
@@ -265,5 +266,5 @@
 
 #        point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]]
-        point1_answers_array = [[5.0,5.0/3600.,1.0,6.0,-5.0,3.0,4.0], [7.0,7.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
+        point1_answers_array = [[2.0,2.0/3600.,1.0,6.0,-5.0,3.0,4.0], [3.0,3.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
         point1_filename = 'gauge_point1.csv'
         point1_handle = file(point1_filename)
@@ -279,5 +280,5 @@
             assert num.allclose(line[i], point1_answers_array[i])
 
-        point2_answers_array = [[5.0,5.0/3600.,1.0,1.5,-0.5,3.0,4.0], [7.0,7.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
+        point2_answers_array = [[2.0,2.0/3600.,1.0,1.5,-0.5,3.0,4.0], [3.0,3.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
         point2_filename = 'gauge_point2.csv' 
         point2_handle = file(point2_filename)
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/file/sww.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/file/sww.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/file/sww.py	(revision 8069)
@@ -941,5 +941,5 @@
     
     try:
-        domain = Domain(coordinates, volumes, boundary)
+        domain = Domain(coordinates, volumes, boundary, starttime=(float(starttime) + float(t)))
     except AssertionError, e:
         fid.close()
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/file/test_read_sww.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/file/test_read_sww.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/file/test_read_sww.py	(revision 8069)
@@ -151,6 +151,4 @@
             new_domain.set_quantity(qname, q)    
 
-
-        new_domain.set_starttime(sww_file.get_time())
         #------------------------------------------------------------------
         # Setup boundary conditions
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/file/test_sww.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/file/test_sww.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/file/test_sww.py	(revision 8069)
@@ -103,5 +103,5 @@
         #Now evolve them both, just to be sure
         ######################################x
-        domain.time = 0.
+
         from time import sleep
 
@@ -116,7 +116,7 @@
             pass
 
-        final = final - (domain2.starttime-domain.starttime)
         #BUT since domain1 gets time hacked back to 0:
-        final = final + (domain2.starttime-domain.starttime)
+        
+        final = final + (domain2.get_starttime() - domain.get_starttime())
 
         domain2.smooth = False
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/file_conversion/sww2dem.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/file_conversion/sww2dem.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/file_conversion/sww2dem.py	(revision 8069)
@@ -78,8 +78,8 @@
     'elevation'. Quantity is not a list of quantities.
 
-    if timestep (an index) is given, output quantity at that timestep
-
-    if reduction is given and its an index, output quantity at that timestep. If reduction is given
-    and is a built in function, use that to reduce quantity over all timesteps.
+    If reduction is given and it's an index, sww2dem will output the quantity at that time-step. 
+    If reduction is given and it's a built in function (eg max, min, mean), then that 
+    function is used to reduce the quantity over all time-steps. If reduction is not given, 
+    reduction is set to "max" by default.
 
     datum
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/file_conversion/test_urs2sts.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/file_conversion/test_urs2sts.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/file_conversion/test_urs2sts.py	(revision 8069)
@@ -1411,4 +1411,5 @@
         
         domain_drchlt = Domain(meshname)
+        domain_drchlt.set_starttime(2.0)
         domain_drchlt.set_quantity('stage', tide)
         Br = Reflective_boundary(domain_drchlt)
@@ -1554,4 +1555,5 @@
 
         domain_drchlt = Domain(meshname)
+        domain_drchlt.set_starttime(2.0)
         domain_drchlt.set_quantity('stage', tide)
         Br = Reflective_boundary(domain_drchlt)
@@ -1919,4 +1921,5 @@
         
         domain_drchlt = Domain(meshname)
+        domain_drchlt.set_starttime(2.0)
         domain_drchlt.set_quantity('stage', tide)
         Br = Reflective_boundary(domain_drchlt)
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/shallow_water_domain.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/shallow_water_domain.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/shallow_water_domain.py	(revision 8069)
@@ -106,4 +106,5 @@
                  full_send_dict=None,
                  ghost_recv_dict=None,
+                 starttime=0,
                  processor=0,
                  numproc=1,
@@ -155,4 +156,5 @@
                             full_send_dict,
                             ghost_recv_dict,
+                            starttime,
                             processor,
                             numproc,
@@ -561,5 +563,5 @@
         self.distribute_to_vertices_and_edges()
 
-        if self.store is True and self.time == 0.0:
+        if self.store is True and self.get_time() == self.get_starttime():
             self.initialise_storage()
 
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_data_manager.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 8069)
@@ -783,4 +783,7 @@
         
         temp_time=num.zeros(int(finaltime/yieldstep)+1,num.float)
+        
+        domain_time.set_starttime(domain_fbound.get_starttime())
+        
         for i, t in enumerate(domain_time.evolve(yieldstep=yieldstep,
                                                    finaltime=finaltime, 
@@ -831,5 +834,5 @@
 if __name__ == "__main__":
     #suite = unittest.makeSuite(Test_Data_Manager, 'test_sww2domain2')
-    suite = unittest.makeSuite(Test_Data_Manager, 'test_sww')
+    suite = unittest.makeSuite(Test_Data_Manager, 'test')
     
     
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_forcing.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_forcing.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_forcing.py	(revision 8069)
@@ -591,9 +591,6 @@
         domain.forcing_terms.append(R)
 
-        # This will test that time used in the forcing function takes
-        # startime into account.
-        domain.starttime = 5.0
-
-        domain.time = 7.
+        # This will test that time is set to starttime in set_starttime
+        domain.set_starttime(5.0)
 
         domain.compute_forcing_terms()
@@ -602,9 +599,5 @@
                             (3*domain.get_time() + 7)/1000)
         assert num.allclose(domain.quantities['stage'].explicit_update[1],
-                            (3*(domain.time + domain.starttime) + 7)/1000)
-
-        # Using internal time her should fail
-        assert not num.allclose(domain.quantities['stage'].explicit_update[1],
-                                (3*domain.time + 7)/1000)
+                            (3*domain.get_starttime() + 7)/1000)
 
         assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
@@ -657,9 +650,6 @@
         domain.forcing_terms.append(R)
 
-        # This will test that time used in the forcing function takes
-        # startime into account.
-        domain.starttime = 5.0
-
-        domain.time = 7.
+        # This will test that time is set to starttime in set_starttime
+        domain.set_starttime(5.0)
 
         domain.compute_forcing_terms()
@@ -668,9 +658,5 @@
                             (3*domain.get_time() + 7)/1000)
         assert num.allclose(domain.quantities['stage'].explicit_update[1],
-                            (3*(domain.time + domain.starttime) + 7)/1000)
-
-        # Using internal time her should fail
-        assert not num.allclose(domain.quantities['stage'].explicit_update[1],
-                                (3*domain.time + 7)/1000)
+                            (3*domain.get_starttime() + 7)/1000)
 
         assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_forcing_terms.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_forcing_terms.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_forcing_terms.py	(revision 8069)
@@ -887,9 +887,6 @@
         domain.forcing_terms.append(R)
 
-        # This will test that time used in the forcing function takes
-        # startime into account.
-        domain.starttime = 5.0
-
-        domain.time = 7.
+        # This will test that time is set to starttime in set_starttime
+        domain.set_starttime(5.0)
 
         domain.compute_forcing_terms()
@@ -898,9 +895,5 @@
                             (3*domain.get_time() + 7)/1000)
         assert num.allclose(domain.quantities['stage'].explicit_update[1],
-                            (3*(domain.time + domain.starttime) + 7)/1000)
-
-        # Using internal time her should fail
-        assert not num.allclose(domain.quantities['stage'].explicit_update[1],
-                                (3*domain.time + 7)/1000)
+                            (3*domain.get_starttime() + 7)/1000)
 
         assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
@@ -953,9 +946,6 @@
         domain.forcing_terms.append(R)
 
-        # This will test that time used in the forcing function takes
-        # startime into account.
-        domain.starttime = 5.0
-
-        domain.time = 7.
+        # This will test that time is set to starttime in set_starttime
+        domain.set_starttime(5.0)
 
         domain.compute_forcing_terms()
@@ -964,9 +954,5 @@
                             (3*domain.get_time() + 7)/1000)
         assert num.allclose(domain.quantities['stage'].explicit_update[1],
-                            (3*(domain.time + domain.starttime) + 7)/1000)
-
-        # Using internal time her should fail
-        assert not num.allclose(domain.quantities['stage'].explicit_update[1],
-                                (3*domain.time + 7)/1000)
+                            (3*domain.get_starttime() + 7)/1000)
 
         assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
Index: /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_system.py
===================================================================
--- /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_system.py	(revision 8068)
+++ /branches/anuga_1_2_0/anuga_core/source/anuga/shallow_water/test_system.py	(revision 8069)
@@ -83,5 +83,5 @@
         """
      
-        boundary_starttime = 500
+        boundary_starttime = 0
         boundary_filename = self.create_sww_boundary(boundary_starttime)
         filename = tempfile.mktemp(".sww")
@@ -131,5 +131,5 @@
         """
         
-        boundary_starttime = 500
+        boundary_starttime = 0
         boundary_filename = self.create_sww_boundary(boundary_starttime)
         #print "boundary_filename",boundary_filename 
@@ -147,5 +147,5 @@
         domain.set_name(senario_name)                 
         domain.set_datadir(dir)
-        new_starttime = 510.
+        new_starttime = 0.
         domain.set_starttime(new_starttime)
 
@@ -178,5 +178,5 @@
         msg += "Not logic. "
         msg += "It's testing that starttime is working"
-        assert num.allclose(stage[2,0], 11.9867153168),msg
+        assert num.allclose(stage[2,0], 4.7981238),msg
         
         
