diff options
author | Sean Dague | 2008-05-12 18:13:58 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-12 18:13:58 +0000 |
commit | 552d8622649b93647c24697eaed8aacac2bce6b3 (patch) | |
tree | ef6351632182ee0cf269a02e947a8404cb53ea0d | |
parent | * Minor: Make some direct grid server console output into logged messages ins... (diff) | |
download | opensim-SC-552d8622649b93647c24697eaed8aacac2bce6b3.zip opensim-SC-552d8622649b93647c24697eaed8aacac2bce6b3.tar.gz opensim-SC-552d8622649b93647c24697eaed8aacac2bce6b3.tar.bz2 opensim-SC-552d8622649b93647c24697eaed8aacac2bce6b3.tar.xz |
move the sun based on localtime instead of utc. Now it won't set for me at
3pm any more.
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index c6cb392..5224f84 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | |||
@@ -75,13 +75,13 @@ namespace OpenSim.Region.Environment.Modules | |||
75 | private Scene m_scene = null; | 75 | private Scene m_scene = null; |
76 | 76 | ||
77 | // Calculated Once in the lifetime of a region | 77 | // Calculated Once in the lifetime of a region |
78 | private ulong TicksToEpoch; // Elapsed time for 1/1/1970 | 78 | private long TicksToEpoch; // Elapsed time for 1/1/1970 |
79 | private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds | 79 | private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds |
80 | private uint SecondsPerYear; // Length of a virtual year in RW seconds | 80 | private uint SecondsPerYear; // Length of a virtual year in RW seconds |
81 | private double SunSpeed; // Rate of passage in radians/second | 81 | private double SunSpeed; // Rate of passage in radians/second |
82 | private double SeasonSpeed; // Rate of change for seasonal effects | 82 | private double SeasonSpeed; // Rate of change for seasonal effects |
83 | private double HoursToRadians; // Rate of change for seasonal effects | 83 | private double HoursToRadians; // Rate of change for seasonal effects |
84 | 84 | private long m_offset = 0; // seconds offset from UTC | |
85 | // Calculated every update | 85 | // Calculated every update |
86 | private float OrbitalPosition; // Orbital placement at a point in time | 86 | private float OrbitalPosition; // Orbital placement at a point in time |
87 | private double HorizonShift; // Axis offset to skew day and night | 87 | private double HorizonShift; // Axis offset to skew day and night |
@@ -95,10 +95,13 @@ namespace OpenSim.Region.Environment.Modules | |||
95 | private LLVector3 Velocity = new LLVector3(0,0,0); | 95 | private LLVector3 Velocity = new LLVector3(0,0,0); |
96 | private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); | 96 | private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); |
97 | 97 | ||
98 | |||
98 | // Current time in elpased seconds since Jan 1st 1970 | 99 | // Current time in elpased seconds since Jan 1st 1970 |
99 | private ulong CurrentTime | 100 | private ulong CurrentTime |
100 | { | 101 | { |
101 | get { return (ulong)((((ulong)System.DateTime.Now.Ticks)-TicksToEpoch)/10000000); } | 102 | get { |
103 | return (ulong)(((System.DateTime.Now.Ticks)-TicksToEpoch)/10000000 + m_offset); | ||
104 | } | ||
102 | } | 105 | } |
103 | 106 | ||
104 | // Called immediately after the module is loaded for a given region | 107 | // Called immediately after the module is loaded for a given region |
@@ -113,9 +116,12 @@ namespace OpenSim.Region.Environment.Modules | |||
113 | 116 | ||
114 | m_frame = 0; | 117 | m_frame = 0; |
115 | 118 | ||
119 | TimeZone local = TimeZone.CurrentTimeZone; | ||
120 | m_offset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Seconds; | ||
121 | |||
116 | // Align ticks with Second Life | 122 | // Align ticks with Second Life |
117 | 123 | ||
118 | TicksToEpoch = (ulong) new System.DateTime(1970,1,1).Ticks; | 124 | TicksToEpoch = new System.DateTime(1970,1,1).Ticks; |
119 | 125 | ||
120 | // Just in case they don't have the stanzas | 126 | // Just in case they don't have the stanzas |
121 | try | 127 | try |