From e826f5808bc35f5fbdbf626b32cf23968fc29ea9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 12 May 2008 18:39:19 +0000 Subject: my last patch didn't actually get the sun to possition correctly, but now we are correctly using the timezone offset. If you set day_length to 24.0 you'll get a sun progression that roughly follows your real world day on your server. --- OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Sun') diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index 5224f84..0314562 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules private double SunSpeed; // Rate of passage in radians/second private double SeasonSpeed; // Rate of change for seasonal effects private double HoursToRadians; // Rate of change for seasonal effects - private long m_offset = 0; // seconds offset from UTC + private long TicksOffset = 0; // seconds offset from UTC // Calculated every update private float OrbitalPosition; // Orbital placement at a point in time private double HorizonShift; // Axis offset to skew day and night @@ -100,7 +100,7 @@ namespace OpenSim.Region.Environment.Modules private ulong CurrentTime { get { - return (ulong)(((System.DateTime.Now.Ticks)-TicksToEpoch)/10000000 + m_offset); + return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset)/10000000); } } @@ -117,7 +117,9 @@ namespace OpenSim.Region.Environment.Modules m_frame = 0; TimeZone local = TimeZone.CurrentTimeZone; - m_offset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Seconds; + TicksOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; + + m_log.Debug("[SUN] localtime offset is " + TicksOffset); // Align ticks with Second Life -- cgit v1.1