Skip to content

Commit

Permalink
Merge branch 'feature/getwallclock' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickson committed Aug 13, 2023
2 parents 8d1cb44 + 423f83d commit feb9005
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion OpenSim/Framework/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class VersionInfo
{
public const string VersionNumber = "0.9.2.2";
public const string AssemblyVersionNumber = "0.9.2.2";
public const string Release = "8619";
public const string Release = "8624";

public const Flavour VERSION_FLAVOUR = Flavour.Dev;

Expand Down
14 changes: 13 additions & 1 deletion OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public int LlRequestAgentDataCacheTimeoutMs
protected float m_recoilScaleFactor = 0.0f;
protected bool m_AllowGodFunctions;

protected string m_GetWallclockTimeZone = String.Empty; // Defaults to UTC
protected double m_timer = Util.GetTimeStampMS();
protected bool m_waitingForScriptAnswer = false;
protected bool m_automaticLinkPermission = false;
Expand Down Expand Up @@ -431,6 +432,8 @@ private void LoadConfig()
m_automaticLinkPermission = seConfig.GetBoolean("AutomaticLinkPermission", m_automaticLinkPermission);
m_notecardLineReadCharsMax = seConfig.GetInt("NotecardLineReadCharsMax", m_notecardLineReadCharsMax);

m_GetWallclockTimeZone = seConfig.GetString("GetWallclockTimeZone", m_GetWallclockTimeZone);

// Rezzing an object with a velocity can create recoil. This feature seems to have been
// removed from recent versions of SL. The code computes recoil (vel*mass) and scales
// it by this factor. May be zero to turn off recoil all together.
Expand Down Expand Up @@ -3113,7 +3116,16 @@ public LSL_Float llGetTimeOfDay()

public LSL_Float llGetWallclock()
{
return DateTime.Now.TimeOfDay.TotalSeconds;
DateTimeOffset dateTimeOffset = DateTimeOffset.Now;

if (string.IsNullOrEmpty(m_GetWallclockTimeZone) == false)
{
dateTimeOffset =
TimeZoneInfo.ConvertTimeBySystemTimeZoneId(
DateTimeOffset.UtcNow, m_GetWallclockTimeZone);
}

return Math.Truncate(dateTimeOffset.DateTime.TimeOfDay.TotalSeconds);
}

public LSL_Float llGetTime()
Expand Down
13 changes: 12 additions & 1 deletion bin/OpenSim.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,12 @@
;; Increasing this to large values potentially opens
;; up the system to malicious scripters
; NotecardLineReadCharsMax = 255

; llGetWallclock returns a float that is the time in seconds since midnight Pacific time (PST/PDT), truncated to whole seconds.
; How you specify that time zone varies based on system type (Linux, Windows or Mac). If this value is not set (the default)
; we will return whatever the system time is. You can define the timezone id for PST if you prefer that behaviour.
; Normal default for Linux is "America/Los_Angeles" from the ICU database and for Windows is: "Pacific Standard Time"
; GetWallclockTimeZone = "America/Los_Angeles"

;# {SensorMaxRange} {} {Sensor range} {} 96.0
;; Sensor settings
Expand Down Expand Up @@ -1131,6 +1137,12 @@
;# {SensorMaxResults} {} {Max sensor results returned?} {}
; SensorMaxResults = 16

; llGetWallclock returns a float that is the time in seconds since midnight Pacific time (PST/PDT), truncated to whole seconds.
; How you specify that time zone varies based on system type (Linux, Windows or Mac). If this value is not set (the default)
; we will return whatever the system time is. You can define the timezone id for PST if you prefer that behaviour.
; Normal default for Linux is "America/Los_Angeles" from the ICU database and for Windows is: "Pacific Standard Time"
; GetWallclockTimeZone = "America/Los_Angeles"

;# {DisableUndergroundMovement} {} {Disable underground movement of prims} {true false} true
;; Disable underground movement of prims (default true); set to
;; false to allow script controlled underground positioning of
Expand All @@ -1147,7 +1159,6 @@
;; If this INI file is not included, the OSSL functions are disabled.
Include-osslDefaultEnable = "config-include/osslDefaultEnable.ini"


[FreeSwitchVoice]
;; In order for this to work you need a functioning FreeSWITCH PBX set up.
;; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module
Expand Down
13 changes: 11 additions & 2 deletions bin/OpenSimDefaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,11 @@
; prims
; DisableUndergroundMovement = true

; llGetWallclock returns a float that is the time in seconds since midnight Pacific time (PST/PDT), truncated to whole seconds.
; How you specify that time zone varies based on system type (Linux, Windows or Mac). If this value is not set (the default)
; we will return whatever the system time is. You can define the timezone id for PST if you prefer that behaviour.
; Normal default for Linux is "America/Los_Angeles" from the ICU database and for Windows is: "Pacific Standard Time"
; GetWallclockTimeZone = "America/Los_Angeles"

; scripts states and cache parent folder location
;ScriptEnginesPath="ScriptEngines"
Expand Down Expand Up @@ -1830,7 +1835,6 @@
; This does not delete cached scripts state.
; DeleteScriptsOnStartup = true


; Controls whether scripts are stopped by aborting their threads externally (abort)
; or by co-operative checks inserted by OpenSimulator into compiled script (co-op).
; co-op will be more stable as aborting threads can cause instability.
Expand All @@ -1849,7 +1853,6 @@
; Compile debug info (line numbers) into the script assemblies
CompileWithDebugInformation = true


; Interval (s) between background save of script states
SaveInterval = 120

Expand Down Expand Up @@ -1881,6 +1884,12 @@
; rounded up to this minimum interval.
; MinTimerInterval = 0.5

; llGetWallclock returns a float that is the time in seconds since midnight Pacific time (PST/PDT), truncated to whole seconds.
; How you specify that time zone varies based on system type (Linux, Windows or Mac). If this value is not set (the default)
; we will return whatever the system time is. You can define the timezone id for PST if you prefer that behaviour.
; Normal default for Linux is "America/Los_Angeles" from the ICU database and for Windows is: "Pacific Standard Time"
; GetWallclockTimeZone = "America/Los_Angeles"

; Sensor settings
;SensorMaxRange = 96.0
;SensorMaxResults = 16
Expand Down

0 comments on commit feb9005

Please sign in to comment.