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.
0.6.0-stable
Sean Dague 2008-05-12 18:39:19 +00:00
parent 552d862264
commit e826f5808b
1 changed files with 5 additions and 3 deletions

View File

@ -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