summary refs log tree commit diff stats
path: root/lib/os.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/os.nim')
-rw-r--r--[-rwxr-xr-x]lib/os.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/os.nim b/lib/os.nim
index 5f9ea88a1..cd835c480 100755..100644
--- a/lib/os.nim
+++ b/lib/os.nim
@@ -294,6 +294,10 @@ proc existsDir*(dir: string): bool
 proc getLastModificationTime*(file: string): TTime
   ## Gets the time of the `file`'s last modification.
 
+proc fileNewer*(a, b: string): bool 
+  ## returns true if the file `a` is newer than file `b`, i.e. if `a`'s
+  ## modification time is later than `b`'s.
+
 # procs dealing with environment variables:
 proc putEnv*(key, val: string)
   ## Sets the value of the environment variable named `key` to `val`.
@@ -936,4 +940,7 @@ else:
 
   proc paramCount(): int = return cmdCount-1
 
+proc fileNewer(a, b: string): bool =
+  result = getLastModificationTime(a) - getLastModificationTime(b) > 0
+
 {.pop.}