Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
' This example is taken directly from the FB documentation (see [http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgFiledatetime])
|
||||
|
||||
#include "vbcompat.bi" '' to use Format function
|
||||
|
||||
Dim filename As String, d As Double
|
||||
|
||||
Print "Enter a filename: "
|
||||
Line Input filename
|
||||
|
||||
If FileExists(filename) Then
|
||||
Print "File last modified: ";
|
||||
d = FileDateTime( filename )
|
||||
Print Format( d, "yyyy-mm-dd hh:mm AM/PM" )
|
||||
Else
|
||||
Print "File not found"
|
||||
End If
|
||||
|
||||
Sleep
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
local(f) = file('input.txt')
|
||||
handle => { #f->close }
|
||||
#f->modificationDate->format('%-D %r')
|
||||
// result: 12/2/2010 11:04:15 PM
|
||||
16
Task/File-modification-time/Nim/file-modification-time.nim
Normal file
16
Task/File-modification-time/Nim/file-modification-time.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import os, times
|
||||
let accTime = getLastAccessTime("filename")
|
||||
let modTime = getLastModificationTime("filename")
|
||||
|
||||
import posix
|
||||
var unixAccTime = Timeval(tv_sec: int(accTime))
|
||||
var unixModTime = Timeval(tv_sec: int(modTime))
|
||||
|
||||
# Set the modification time
|
||||
unixModTime.tv_sec = 0
|
||||
|
||||
var times = [unixAccTime, unixModTime]
|
||||
discard utimes("filename", addr(times))
|
||||
|
||||
# Set the access and modification times to the current time
|
||||
discard utimes("filename", nil)
|
||||
|
|
@ -0,0 +1 @@
|
|||
File new("myfile.txt") modified
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
var file = File.new(__FILE__);
|
||||
say file.stat.mtime; # seconds since the epoch
|
||||
|
||||
# keep atime unchanged
|
||||
# set mtime to current time
|
||||
file.utime(file.stat.atime, Time.now);
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
decl java.util.Date d
|
||||
decl file f
|
||||
|
||||
f.open "example.txt"
|
||||
d.setTime (f.lastmodified)
|
||||
out d endl console
|
||||
|
||||
f.setlastmodified 10
|
||||
Loading…
Add table
Add a link
Reference in a new issue