Merge branch 'feature/home' into dev

This commit is contained in:
Alex Ling
2020-06-08 15:11:09 +00:00
9 changed files with 331 additions and 14 deletions
+13
View File
@@ -135,3 +135,16 @@ end
macro render_component(filename)
render "src/views/components/#{{{filename}}}.ecr"
end
# Works in all Unix systems. Follows https://github.com/crystal-lang/crystal/
# blob/master/src/crystal/system/unix/file_info.cr#L42-L48
def ctime(file_path : String) : Time
res = LibC.stat(file_path, out stat)
raise "Unable to get ctime of file #{file_path}" if res != 0
{% if flag?(:darwin) %}
Time.new stat.st_ctimespec, Time::Location::UTC
{% else %}
Time.new stat.st_ctim, Time::Location::UTC
{% end %}
end