Skip to content

Conversation

@masaedw
Copy link

@masaedw masaedw commented Apr 20, 2017

TimeZone used by os.time () is hard coded in TimeZoneInfo.LocalTime, but by applying this pull request, it can be changed for each Script object.

ex)

Script S = new Script();
// set your preferred TimeZoneInfo
S.Options.LocalTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
// You can get local time different from the system time zone
DynValue res = S.DoString("return os.date(\"%Y-%m-%d %H:%M:%S\")");

@LimpingNinja LimpingNinja self-assigned this Jan 9, 2020
@LimpingNinja LimpingNinja self-requested a review January 15, 2020 23:51
Copy link
Contributor

@LimpingNinja LimpingNinja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, we've got new maintainers now and are culling the backlog.

try
{
reference = TimeZoneInfo.ConvertTimeFromUtc(reference, TimeZoneInfo.Local);
TimeZoneInfo localTimeZoneInfo = executionContext.OwnerScript.Options.LocalTimeZoneInfo ?? TimeZoneInfo.Local;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic needs to be added to:

src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/CoreLib/OsTimeModule.cs
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/CoreLib/OsTimeModule.cs

If adding this in to the current system; as we push to clean this up it will change, but for now this PR will be accepted if the additional locations are updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants