Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Compatibility with crystal 0.27.0 #25

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/ssh2_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe SSH2 do
end

it "should be able to scp transfer file" do
fn = "#{Time.now.epoch}.txt"
fn = "#{Time.now.to_unix}.txt"
connect_ssh do |session|
session.scp_send(fn, 0o0644, 12) do |ch|
ch.puts "hello world"
Expand Down Expand Up @@ -101,7 +101,7 @@ describe SSH2::SFTP do
it "should be able to upload a file" do
connect_ssh do |ssh|
ssh.sftp_session do |sftp|
fn = "#{Time.now.epoch}_upload.txt"
fn = "#{Time.now.to_unix}_upload.txt"
file = sftp.open(fn, "wc", 0o644)
file.puts "hello world!"
attrs = file.fstat
Expand Down
2 changes: 1 addition & 1 deletion src/session.cr
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class SSH2::Session

# Send a file to the remote host via SCP.
# A new channel is passed to the block and closed afterwards.
def scp_send(path, mode, size, mtime = Time.now.epoch, atime = Time.now.epoch)
def scp_send(path, mode, size, mtime = Time.now.to_unix, atime = Time.now.to_unix)
channel = scp_send(path, mode, size, mtime, atime)
begin
yield channel
Expand Down
2 changes: 1 addition & 1 deletion src/sftp/attributes.cr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SSH2::SFTP::Attributes
end

def atime
Time.epoch(@stat.atime.to_i32)
Time.unix(@stat.atime.to_i32)
end

def atime=(v : Time)
Expand Down