diff --git a/shard.yml b/shard.yml index a8f9f66..91d4b23 100644 --- a/shard.yml +++ b/shard.yml @@ -1,6 +1,6 @@ name: myst version: 0.3.0 -crystal: 0.24.1 +crystal: 0.26.1 license: MIT authors: - Jon Egeland diff --git a/src/myst/interpreter/native_lib/file.cr b/src/myst/interpreter/native_lib/file.cr index a162065..1b92f18 100644 --- a/src/myst/interpreter/native_lib/file.cr +++ b/src/myst/interpreter/native_lib/file.cr @@ -81,7 +81,11 @@ module Myst end NativeLib.method :static_File_lines, MTValue, file_name : String do - TList.new(File.each_line(file_name).map{ |l| l.as(MTValue) }.to_a) + lines = File.open(file_name) do |file| + file.each_line.map { |l| l.as(MTValue) }.to_a + end + + TList.new(lines) end diff --git a/src/myst/interpreter/native_lib/time.cr b/src/myst/interpreter/native_lib/time.cr index e817913..23b6626 100644 --- a/src/myst/interpreter/native_lib/time.cr +++ b/src/myst/interpreter/native_lib/time.cr @@ -2,7 +2,7 @@ module Myst class Interpreter NativeLib.method :static_time_now, MTValue do seconds, nanoseconds = Crystal::System::Time.compute_utc_seconds_and_nanoseconds - offset = Crystal::System::Time.compute_utc_offset(seconds) + offset = Time.new(seconds: seconds, nanoseconds: nanoseconds, location: Time::Location.local).offset instance = NativeLib.instantiate(self, this.as(TType), [ seconds + offset, @@ -18,7 +18,7 @@ module Myst if format crystal_time.to_s(format) else - crystal_time.to_s + crystal_time.to_s("%Y-%m-%d %H:%M:%S") end end @@ -35,7 +35,7 @@ module Myst Time.new( seconds: myst_time.ivars["@seconds"].as(Int64), nanoseconds: myst_time.ivars["@nanoseconds"].as(Int64).to_i32, - kind: Time::Kind::Unspecified + location: Time::Location::UTC ) end end