Change FileStat.ctime in Elixir

62 Views Asked by At

I intend to do sorting of files by date. To test my function I created an environment with a Stream with File.Stats which is represented as the follwing:

@type t() :: %File.Stat{
  access: :read | :write | :read_write | :none,
  atime: :calendar.datetime() | integer(),
  ctime: :calendar.datetime() | integer(),
  gid: non_neg_integer(),
  inode: non_neg_integer(),
  links: non_neg_integer(),
  major_device: non_neg_integer(),
  minor_device: non_neg_integer(),
  mode: non_neg_integer(),
  mtime: :calendar.datetime() | integer(),
  size: non_neg_integer(),
  type: :device | :directory | :regular | :other | :symlink,
  uid: non_neg_integer()
}

I want to manipulate the ctime of those File.Stats manually by code.

In my test_file.exs I used the Process.sleep(1001) command to ensure the ctimes will never match, unfortunately this makes my tests run very slow.

0

There are 0 best solutions below