public void UpdateDirection()
{
DateTime now = Reference.Viewer.WorldTime;
TimeSpan span = new DateTime(2009, 1, 1, now.Hour, now.Minute, now.Second) - DateTime.Parse("2009-01-01 07:00:00");
int sec = span.Hours * 3600 + span.Minutes * 60 + span.Seconds;
int end = 10 * 3600 + 0 * 60 + 0;
float amount = (float)sec / end;
amount = Util.Clamp<float>(amount, 0, 1);
angle = OpenViewer.Util.Lerp(sunriseAngle, sunsetAngle, amount);
qx.fromAngleAxis((float)(Math.PI / 1.25f), new Vector3D(1, 0, 0));
qy.fromAngleAxis(angle, new Vector3D(0, 1, 0));
qy = qx * qy;
Vector3D rot;
qy.toEuler(out rot);
rotation = new Vector3D(rot.X, rot.Y, rot.Z) * OpenMetaverse.Utils.RAD_TO_DEG;
}