all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
5
Task/System-time/0DESCRIPTION
Normal file
5
Task/System-time/0DESCRIPTION
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Output the system time (any units will do as long as they are noted) either by a [[Execute a System Command|system command]] or one built into the language. The system time can be used for debugging, network information, random number seeds, or something as simple as program performance.
|
||||
|
||||
'''See Also'''
|
||||
* [[Date format]]
|
||||
* [[wp:System time#Retrieving system time|Retrieving system time (wiki)]]
|
||||
2
Task/System-time/1META.yaml
Normal file
2
Task/System-time/1META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
note: Programming environment operations
|
||||
5
Task/System-time/ALGOL-68/system-time.alg
Normal file
5
Task/System-time/ALGOL-68/system-time.alg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FORMAT time repr = $"year="4d,", month="2d,", day="2d,", hours="2d,", \
|
||||
minutes="2d,", seconds="2d,", day of week="d,", \
|
||||
daylight-saving-time flag="dl$;
|
||||
printf((time repr, local time));
|
||||
printf((time repr, utc time))
|
||||
2
Task/System-time/AWK/system-time.awk
Normal file
2
Task/System-time/AWK/system-time.awk
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$ awk 'BEGIN{print systime(),strftime()}'
|
||||
1242401632 Fri May 15 17:33:52 2009
|
||||
10
Task/System-time/Ada/system-time.ada
Normal file
10
Task/System-time/Ada/system-time.ada
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
with Ada.Calendar; use Ada.Calendar;
|
||||
with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
|
||||
with Ada.Calendar.Time_Zones; use Ada.Calendar.Time_Zones;
|
||||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
|
||||
procedure System_Time is
|
||||
Now : Time := Clock;
|
||||
begin
|
||||
Put_line(Image(Date => Now, Time_Zone => -7*60));
|
||||
end System_Time;
|
||||
16
Task/System-time/Aime/system-time.aime
Normal file
16
Task/System-time/Aime/system-time.aime
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
date d;
|
||||
|
||||
d_now(d);
|
||||
|
||||
o_integer(d_year(d));
|
||||
o_byte('-');
|
||||
o_fxinteger(2, 10, d_y_month(d));
|
||||
o_byte('-');
|
||||
o_fxinteger(2, 10, d_m_day(d));
|
||||
o_byte(' ');
|
||||
o_fxinteger(2, 10, d_d_hour(d));
|
||||
o_byte(':');
|
||||
o_fxinteger(2, 10, d_h_minute(d));
|
||||
o_byte(':');
|
||||
o_fxinteger(2, 10, d_m_second(d));
|
||||
o_byte('\n');
|
||||
1
Task/System-time/AppleScript/system-time.applescript
Normal file
1
Task/System-time/AppleScript/system-time.applescript
Normal file
|
|
@ -0,0 +1 @@
|
|||
display dialog (current date)
|
||||
2
Task/System-time/AutoHotkey/system-time.ahk
Normal file
2
Task/System-time/AutoHotkey/system-time.ahk
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
FormatTime, t
|
||||
MsgBox,% t
|
||||
1
Task/System-time/AutoIt/system-time.autoit
Normal file
1
Task/System-time/AutoIt/system-time.autoit
Normal file
|
|
@ -0,0 +1 @@
|
|||
MsgBox(0,"Time", "Year: "&@YEAR&",Day: " &@MDAY& ",Hours: "& @HOUR & ", Minutes: "& @MIN &", Seconds: "& @SEC)
|
||||
1
Task/System-time/BASIC/system-time-1.basic
Normal file
1
Task/System-time/BASIC/system-time-1.basic
Normal file
|
|
@ -0,0 +1 @@
|
|||
PRINT TIMER
|
||||
1
Task/System-time/BASIC/system-time-2.basic
Normal file
1
Task/System-time/BASIC/system-time-2.basic
Normal file
|
|
@ -0,0 +1 @@
|
|||
PRINT TIME$
|
||||
1
Task/System-time/BBC-BASIC/system-time-1.bbc
Normal file
1
Task/System-time/BBC-BASIC/system-time-1.bbc
Normal file
|
|
@ -0,0 +1 @@
|
|||
PRINT TIME$
|
||||
1
Task/System-time/BBC-BASIC/system-time-2.bbc
Normal file
1
Task/System-time/BBC-BASIC/system-time-2.bbc
Normal file
|
|
@ -0,0 +1 @@
|
|||
PRINT RIGHT$(TIME$,8)
|
||||
2
Task/System-time/Batch-File/system-time-1.bat
Normal file
2
Task/System-time/Batch-File/system-time-1.bat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
date /t
|
||||
time /t
|
||||
1
Task/System-time/Batch-File/system-time-2.bat
Normal file
1
Task/System-time/Batch-File/system-time-2.bat
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo %DATE% %TIME%
|
||||
8
Task/System-time/C++/system-time.cpp
Normal file
8
Task/System-time/C++/system-time.cpp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include <iostream>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
int main( ) {
|
||||
boost::posix_time::ptime t ( boost::posix_time::second_clock::local_time( ) ) ;
|
||||
std::cout << to_simple_string( t ) << std::endl ;
|
||||
return 0 ;
|
||||
}
|
||||
8
Task/System-time/C/system-time.c
Normal file
8
Task/System-time/C/system-time.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include<time.h>
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
int main(){
|
||||
time_t my_time = time(NULL);
|
||||
printf("%s", ctime(&my_time));
|
||||
return 0;
|
||||
}
|
||||
7
Task/System-time/Clojure/system-time.clj
Normal file
7
Task/System-time/Clojure/system-time.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(import '[java.util Date])
|
||||
; the current system date time string
|
||||
(print (new Date))
|
||||
; the system time as milliseconds since 1970
|
||||
(print (. (new Date) getTime))
|
||||
; or
|
||||
(print (System/currentTimeMillis))
|
||||
2
Task/System-time/Common-Lisp/system-time.lisp
Normal file
2
Task/System-time/Common-Lisp/system-time.lisp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(multiple-value-bind (second minute hour day month year) (get-decoded-time)
|
||||
(format t "~4,'0D-~2,'0D-~2,'0D ~2,'0D:~2,'0D:~2,'0D" year month day hour minute second))
|
||||
1
Task/System-time/D/system-time.d
Normal file
1
Task/System-time/D/system-time.d
Normal file
|
|
@ -0,0 +1 @@
|
|||
Stdout(Clock.now.span.days / 365).newline;
|
||||
1
Task/System-time/DWScript/system-time.dwscript
Normal file
1
Task/System-time/DWScript/system-time.dwscript
Normal file
|
|
@ -0,0 +1 @@
|
|||
PrintLn(FormatDateTime('dd mmmm yyyy hh:mm:ss', Now));
|
||||
1
Task/System-time/Delphi/system-time.delphi
Normal file
1
Task/System-time/Delphi/system-time.delphi
Normal file
|
|
@ -0,0 +1 @@
|
|||
lblDateTime.Caption := FormatDateTime('dd mmmm yyyy hh:mm:ss', Now);
|
||||
1
Task/System-time/E/system-time.e
Normal file
1
Task/System-time/E/system-time.e
Normal file
|
|
@ -0,0 +1 @@
|
|||
println(timer.now())
|
||||
2
Task/System-time/Erlang/system-time-1.erl
Normal file
2
Task/System-time/Erlang/system-time-1.erl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
1> os:timestamp().
|
||||
{1250,222584,635452}
|
||||
6
Task/System-time/Erlang/system-time-2.erl
Normal file
6
Task/System-time/Erlang/system-time-2.erl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
2> calendar:now_to_datetime(os:timestamp()).
|
||||
{{2009,8,14},{4,3,24}}
|
||||
3> calendar:now_to_universal_time(os:timestamp()).
|
||||
{{2009,8,14},{4,3,40}}
|
||||
4> calendar:now_to_local_time(os:timestamp()).
|
||||
{{2009,8,14},{0,7,01}}
|
||||
3
Task/System-time/Factor/system-time.factor
Normal file
3
Task/System-time/Factor/system-time.factor
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
USE: calendar
|
||||
|
||||
now .
|
||||
6
Task/System-time/Fantom/system-time.fantom
Normal file
6
Task/System-time/Fantom/system-time.fantom
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fansh> DateTime.nowTicks
|
||||
351823905158000000
|
||||
fansh> DateTime.now
|
||||
2011-02-24T00:51:47.066Z London
|
||||
fansh> DateTime.now.toJava
|
||||
1298508885979
|
||||
18
Task/System-time/Forth/system-time.fth
Normal file
18
Task/System-time/Forth/system-time.fth
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[UNDEFINED] MS@ [IF] \ Win32Forth (rolls over daily)
|
||||
[DEFINED] ?MS [IF] ( -- ms )
|
||||
: ms@ ?MS ; \ iForth
|
||||
[ELSE] [DEFINED] cputime [IF] ( -- Dusec )
|
||||
: ms@ cputime d+ 1000 um/mod nip ; \ gforth: Anton Ertl
|
||||
[ELSE] [DEFINED] timer@ [IF] ( -- Dusec )
|
||||
: ms@ timer@ >us 1000 um/mod nip ; \ bigForth
|
||||
[ELSE] [DEFINED] gettimeofday [IF] ( -- usec sec )
|
||||
: ms@ gettimeofday 1000 MOD 1000 * SWAP 1000 / + ; \ PFE
|
||||
[ELSE] [DEFINED] counter [IF]
|
||||
: ms@ counter ; \ SwiftForth
|
||||
[ELSE] [DEFINED] GetTickCount [IF]
|
||||
: ms@ GetTickCount ; \ VFX Forth
|
||||
[ELSE] [DEFINED] MICROSECS [IF]
|
||||
: ms@ microsecs 1000 UM/MOD nip ; \ MacForth
|
||||
[THEN] [THEN] [THEN] [THEN] [THEN] [THEN] [THEN]
|
||||
|
||||
MS@ . \ print millisecond counter
|
||||
13
Task/System-time/Fortran/system-time-1.f
Normal file
13
Task/System-time/Fortran/system-time-1.f
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
integer :: start, stop, rate
|
||||
real :: result
|
||||
|
||||
! optional 1st integer argument (COUNT) is current raw system clock counter value (not UNIX epoch millis!!)
|
||||
! optional 2nd integer argument (COUNT_RATE) is clock cycles per second
|
||||
! optional 3rd integer argument (COUNT_MAX) is maximum clock counter value
|
||||
call system_clock( start, rate )
|
||||
|
||||
result = do_timed_work()
|
||||
|
||||
call system_clock( stop )
|
||||
|
||||
print *, "elapsed time: ", real(stop - start) / real(rate)
|
||||
11
Task/System-time/Fortran/system-time-2.f
Normal file
11
Task/System-time/Fortran/system-time-2.f
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
real :: start, stop
|
||||
real :: result
|
||||
|
||||
! System clock value interpreted as floating point seconds
|
||||
call cpu_time( start )
|
||||
|
||||
result = do_timed_work()
|
||||
|
||||
call cpu_time( stop )
|
||||
|
||||
print *, "elapsed time: ", stop - start
|
||||
1
Task/System-time/GUISS/system-time.guiss
Normal file
1
Task/System-time/GUISS/system-time.guiss
Normal file
|
|
@ -0,0 +1 @@
|
|||
Taskbar
|
||||
10
Task/System-time/Go/system-time.go
Normal file
10
Task/System-time/Go/system-time.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import "time"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
t := time.Now()
|
||||
fmt.Println(t) // default format
|
||||
fmt.Println(t.Format("Mon Jan 2 15:04:05 2006")) // some custom format
|
||||
}
|
||||
2
Task/System-time/Groovy/system-time.groovy
Normal file
2
Task/System-time/Groovy/system-time.groovy
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def nowMillis = new Date().time
|
||||
println 'Milliseconds since the start of the UNIX Epoch (Jan 1, 1970) == ' + nowMillis
|
||||
7
Task/System-time/Haskell/system-time-1.hs
Normal file
7
Task/System-time/Haskell/system-time-1.hs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import System.Time
|
||||
import System.Locale
|
||||
|
||||
main = do ct <- getClockTime
|
||||
print ct -- print default format, or
|
||||
cal <- toCalendarTime ct
|
||||
putStrLn $ formatCalendarTime defaultTimeLocale "%a %b %e %H:%M:%S %Y" cal
|
||||
6
Task/System-time/Haskell/system-time-2.hs
Normal file
6
Task/System-time/Haskell/system-time-2.hs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import Data.Time
|
||||
import System.Locale
|
||||
|
||||
main = do zt <- getZonedTime
|
||||
print zt -- print default format, or
|
||||
putStrLn $ formatTime defaultTimeLocale "%a %b %e %H:%M:%S %Y" zt
|
||||
4
Task/System-time/HicEst/system-time.hicest
Normal file
4
Task/System-time/HicEst/system-time.hicest
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
seconds_since_midnight = TIME() ! msec as fraction
|
||||
|
||||
seconds_since_midnight = TIME(Year=yr, Day=day, WeekDay=wday, Gregorian=gday)
|
||||
! other options e.g. Excel, YYYYMMDD (num or text)
|
||||
11
Task/System-time/Icon/system-time.icon
Normal file
11
Task/System-time/Icon/system-time.icon
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
procedure main()
|
||||
|
||||
write("&time - milliseconds of CPU time = ",&time)
|
||||
write("&clock - Time of day as hh:mm:ss (24-hour format) = ",&clock)
|
||||
write("&date - current date in yyyy/mm/dd format = ",&date)
|
||||
write("&dateline - timestamp with day of the week, date, and current time to the minute = ",&dateline)
|
||||
|
||||
if find("Unicon",&version) then
|
||||
write("&now - time in seconds since the epoch = ", &now) # Unicon only
|
||||
|
||||
end
|
||||
1
Task/System-time/Io/system-time-1.io
Normal file
1
Task/System-time/Io/system-time-1.io
Normal file
|
|
@ -0,0 +1 @@
|
|||
Date now println
|
||||
1
Task/System-time/Io/system-time-2.io
Normal file
1
Task/System-time/Io/system-time-2.io
Normal file
|
|
@ -0,0 +1 @@
|
|||
2008-08-26 00:15:52 EDT
|
||||
2
Task/System-time/J/system-time-1.j
Normal file
2
Task/System-time/J/system-time-1.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
6!:0 ''
|
||||
2008 1 23 12 52 10.341
|
||||
2
Task/System-time/J/system-time-2.j
Normal file
2
Task/System-time/J/system-time-2.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
6!:0 'YYYY-MM-DD hh:mm:ss.sss'
|
||||
2009-08-26 10:38:53.171
|
||||
5
Task/System-time/Java/system-time-1.java
Normal file
5
Task/System-time/Java/system-time-1.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
public class SystemTime{
|
||||
public static void main(String[] args){
|
||||
System.out.format("%tc%n", System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
11
Task/System-time/Java/system-time-2.java
Normal file
11
Task/System-time/Java/system-time-2.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import java.util.Date;
|
||||
|
||||
public class SystemTime{
|
||||
public static void main(String[] args){
|
||||
Date now = new Date();
|
||||
System.out.println(now); // string representation
|
||||
|
||||
System.out.println(now.getTime()); // Unix time (# of milliseconds since Jan 1 1970)
|
||||
//System.currentTimeMillis() returns the same value
|
||||
}
|
||||
}
|
||||
3
Task/System-time/JavaScript/system-time.js
Normal file
3
Task/System-time/JavaScript/system-time.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
console.log(new Date()) // => Sat, 28 May 2011 08:22:53 GMT
|
||||
|
||||
console.log(Date.now()) // => 1306571005417 // Unix epoch
|
||||
4
Task/System-time/Liberty-BASIC/system-time.liberty
Normal file
4
Task/System-time/Liberty-BASIC/system-time.liberty
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
print time$() 'time now as string "16:21:44"
|
||||
print time$("seconds") 'seconds since midnight as number 32314
|
||||
print time$("milliseconds") 'milliseconds since midnight as number 33221342
|
||||
print time$("ms") 'milliseconds since midnight as number 33221342
|
||||
2
Task/System-time/Locomotive-Basic/system-time.locomotive
Normal file
2
Task/System-time/Locomotive-Basic/system-time.locomotive
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
print time
|
||||
print time/300;"s since last reboot"
|
||||
7
Task/System-time/Logo/system-time.logo
Normal file
7
Task/System-time/Logo/system-time.logo
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
to time
|
||||
output first first shell [date +%s]
|
||||
end
|
||||
|
||||
make "start time
|
||||
wait 300 ; 60ths of a second
|
||||
print time - :start ; 5
|
||||
1
Task/System-time/Lua/system-time.lua
Normal file
1
Task/System-time/Lua/system-time.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
print(os.date())
|
||||
1
Task/System-time/MATLAB/system-time-1.m
Normal file
1
Task/System-time/MATLAB/system-time-1.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
datestr(now)
|
||||
1
Task/System-time/MATLAB/system-time-2.m
Normal file
1
Task/System-time/MATLAB/system-time-2.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
clock
|
||||
6
Task/System-time/MUMPS/system-time.mumps
Normal file
6
Task/System-time/MUMPS/system-time.mumps
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
SYSTIME
|
||||
NEW PH
|
||||
SET PH=$PIECE($HOROLOG,",",2)
|
||||
WRITE "The system time is ",PH\3600,":",PH\60#60,":",PH#60
|
||||
KILL PH
|
||||
QUIT
|
||||
2
Task/System-time/Mathematica/system-time.math
Normal file
2
Task/System-time/Mathematica/system-time.math
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Print[DateList[]]
|
||||
Print[AbsoluteTime[]]
|
||||
10
Task/System-time/Maxima/system-time.maxima
Normal file
10
Task/System-time/Maxima/system-time.maxima
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* Time and date in a formatted string */
|
||||
timedate();
|
||||
"2012-08-27 20:26:23+10:00"
|
||||
|
||||
/* Time in seconds elapsed since 1900/1/1 0:0:0 */
|
||||
absolute_real_time();
|
||||
|
||||
/* Time in seconds since Maxima was started */
|
||||
elapsed_real_time();
|
||||
elapsed_run_time();
|
||||
7
Task/System-time/Modula-3/system-time.mod3
Normal file
7
Task/System-time/Modula-3/system-time.mod3
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
MODULE MyTime EXPORTS Main;
|
||||
|
||||
IMPORT IO, FmtTime, Time;
|
||||
|
||||
BEGIN
|
||||
IO.Put("Current time: " & FmtTime.Long(Time.Now()) & "\n");
|
||||
END MyTime.
|
||||
2
Task/System-time/NetRexx/system-time.netrexx
Normal file
2
Task/System-time/NetRexx/system-time.netrexx
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import java.text.SimpleDateFormat
|
||||
say SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS").format(Date())
|
||||
12
Task/System-time/OCaml/system-time.ocaml
Normal file
12
Task/System-time/OCaml/system-time.ocaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#load "unix.cma";;
|
||||
open Unix;;
|
||||
let {tm_sec = sec;
|
||||
tm_min = min;
|
||||
tm_hour = hour;
|
||||
tm_mday = mday;
|
||||
tm_mon = mon;
|
||||
tm_year = year;
|
||||
tm_wday = wday;
|
||||
tm_yday = yday;
|
||||
tm_isdst = isdst} = localtime (time ());;
|
||||
Printf.printf "%04d-%02d-%02d %02d:%02d:%02d\n" (year + 1900) (mon + 1) mday hour min sec;;
|
||||
4
Task/System-time/Objeck/system-time.objeck
Normal file
4
Task/System-time/Objeck/system-time.objeck
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
function : Time() ~ Nil {
|
||||
t := Time->New();
|
||||
IO.Console->GetInstance()->Print(t->GetHours())->Print(":")->Print(t->GetMinutes())->Print(":")->PrintLine(t->GetSeconds());
|
||||
}
|
||||
1
Task/System-time/Objective-C/system-time-1.m
Normal file
1
Task/System-time/Objective-C/system-time-1.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
NSLog(@"%@", [NSDate date]);
|
||||
1
Task/System-time/Objective-C/system-time-2.m
Normal file
1
Task/System-time/Objective-C/system-time-2.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
NSLog(@"%@", [NSCalendarDate calendarDate]);
|
||||
8
Task/System-time/Oz/system-time.oz
Normal file
8
Task/System-time/Oz/system-time.oz
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{Show {OS.time}} %% posix time (seconds since 1970-01-01)
|
||||
{Show {OS.gmTime}} %% current UTC as a record
|
||||
{Show {OS.localTime}} %% current local time as record
|
||||
|
||||
%% Also interesting: undocumented module OsTime
|
||||
%% When did posix time reach 1 billion?
|
||||
{Show {OsTime.gmtime 1000000000}}
|
||||
{Show {OsTime.localtime 1000000000}}
|
||||
1
Task/System-time/PARI-GP/system-time.pari
Normal file
1
Task/System-time/PARI-GP/system-time.pari
Normal file
|
|
@ -0,0 +1 @@
|
|||
system("date")
|
||||
1
Task/System-time/PHP/system-time-1.php
Normal file
1
Task/System-time/PHP/system-time-1.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo time(), "\n";
|
||||
1
Task/System-time/PHP/system-time-2.php
Normal file
1
Task/System-time/PHP/system-time-2.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo microtime(), "\n";
|
||||
6
Task/System-time/PHP/system-time-3.php
Normal file
6
Task/System-time/PHP/system-time-3.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
echo date('D M j H:i:s Y'), "\n"; // custom format; see format characters here:
|
||||
// http://us3.php.net/manual/en/function.date.php
|
||||
echo date('c'), "\n"; // ISO 8601 format
|
||||
echo date('r'), "\n"; // RFC 2822 format
|
||||
echo date(DATE_RSS), "\n"; // can also use one of the predefined formats here:
|
||||
// http://us3.php.net/manual/en/class.datetime.php#datetime.constants.types
|
||||
4
Task/System-time/PL-I/system-time.pli
Normal file
4
Task/System-time/PL-I/system-time.pli
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
put (datetime()); /* writes out the date and time */
|
||||
/* The time is given to thousandths of a second, */
|
||||
/* in the format hhmiss999 */
|
||||
put (time()); /* gives the time in the format hhmiss999. */
|
||||
43
Task/System-time/Pascal/system-time.pascal
Normal file
43
Task/System-time/Pascal/system-time.pascal
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
program systime;
|
||||
uses DOS;
|
||||
|
||||
{ Format digit with leading zero }
|
||||
function lz(w: word): string;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
str(w,s);
|
||||
if length(s) = 1 then
|
||||
s := '0' + s;
|
||||
lz := s;
|
||||
end;
|
||||
|
||||
var
|
||||
h,m,s,c: word;
|
||||
yr,mo,da,dw: word;
|
||||
dt: datetime;
|
||||
t,ssm: longint;
|
||||
regs: registers;
|
||||
|
||||
begin
|
||||
|
||||
{ Time and Date }
|
||||
GetTime(h,m,s,c);
|
||||
writeln(lz(h),':',lz(m),':',lz(s),'.',c);
|
||||
GetDate(yr,mo,da,dw);
|
||||
writeln(yr,'-',lz(mo),'-',lz(da));
|
||||
|
||||
{ Turbo Epoch, seconds }
|
||||
with dt do begin
|
||||
year := yr; month := mo; day := da;
|
||||
hour := h; min := m; sec := s;
|
||||
end;
|
||||
packtime(dt,t);
|
||||
writeln(t);
|
||||
|
||||
{ Seconds since midnight, PC-BIOS 1Ah }
|
||||
regs.ah := 0; Intr($1A,regs);
|
||||
ssm := round((regs.cx * 65536 + regs.dx) * (65536 / 1192180));
|
||||
writeln(ssm);
|
||||
|
||||
end.
|
||||
1
Task/System-time/Perl-6/system-time.pl6
Normal file
1
Task/System-time/Perl-6/system-time.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
say DateTime.now;
|
||||
1
Task/System-time/Perl/system-time-1.pl
Normal file
1
Task/System-time/Perl/system-time-1.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
print scalar localtime, "\n";
|
||||
2
Task/System-time/Perl/system-time-2.pl
Normal file
2
Task/System-time/Perl/system-time-2.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;
|
||||
printf("%04d-%02d-%02d %02d:%02d:%02d\n", $year + 1900, $mon + 1, $mday, $hour, $min, $sec);
|
||||
5
Task/System-time/Perl/system-time-3.pl
Normal file
5
Task/System-time/Perl/system-time-3.pl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
use DateTime;
|
||||
my $dt = DateTime->now;
|
||||
my $d = $dt->ymd;
|
||||
my $t = $dt->hms;
|
||||
print "$d $t\n";
|
||||
4
Task/System-time/Perl/system-time-4.pl
Normal file
4
Task/System-time/Perl/system-time-4.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use POSIX qw(strftime);
|
||||
|
||||
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
|
||||
print "$now_string\n";
|
||||
6
Task/System-time/Perl/system-time-5.pl
Normal file
6
Task/System-time/Perl/system-time-5.pl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
use DateTime;
|
||||
my $dt = DateTime->now;
|
||||
say $dt->iso8601();
|
||||
say $dt->year_with_christian_era();
|
||||
say $dt->year_with_secular_era();
|
||||
# etc.
|
||||
1
Task/System-time/Perl/system-time-6.pl
Normal file
1
Task/System-time/Perl/system-time-6.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
print time;
|
||||
1
Task/System-time/PicoLisp/system-time.l
Normal file
1
Task/System-time/PicoLisp/system-time.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(stamp)
|
||||
1
Task/System-time/PowerShell/system-time-1.psh
Normal file
1
Task/System-time/PowerShell/system-time-1.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
Get-Date
|
||||
1
Task/System-time/PowerShell/system-time-2.psh
Normal file
1
Task/System-time/PowerShell/system-time-2.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
[DateTime]::Now
|
||||
6
Task/System-time/PureBasic/system-time.purebasic
Normal file
6
Task/System-time/PureBasic/system-time.purebasic
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
time=Date() ; Unix timestamp
|
||||
time$=FormatDate("%mm.%dd.%yyyy %hh:%ii:%ss",time)
|
||||
|
||||
; following value is only reasonable accurate, on Windows it can differ by +/- 20 ms
|
||||
ms_counter=ElapsedMilliseconds()
|
||||
; could use API like QueryPerformanceCounter_() on Windows for more accurate values
|
||||
2
Task/System-time/Python/system-time.py
Normal file
2
Task/System-time/Python/system-time.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import time
|
||||
print time.ctime()
|
||||
12
Task/System-time/Q/system-time.q
Normal file
12
Task/System-time/Q/system-time.q
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
q).z.D
|
||||
2010.01.25
|
||||
q).z.N
|
||||
0D14:17:45.519682000
|
||||
q).z.P
|
||||
2010.01.25D14:17:46.962375000
|
||||
q).z.T
|
||||
14:17:47.817
|
||||
q).z.Z
|
||||
2010.01.25T14:17:48.711
|
||||
q).z.z
|
||||
2010.01.25T19:17:59.445
|
||||
1
Task/System-time/R/system-time.r
Normal file
1
Task/System-time/R/system-time.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
Sys.time()
|
||||
2
Task/System-time/REBOL/system-time.rebol
Normal file
2
Task/System-time/REBOL/system-time.rebol
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
now
|
||||
print rejoin [now/year "-" now/month "-" now/day " " now/time]
|
||||
11
Task/System-time/REXX/system-time.rexx
Normal file
11
Task/System-time/REXX/system-time.rexx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
say time() /* hh:mm:ss (hh is 00 --> 23). */
|
||||
say time('n') /* (same as above) */
|
||||
say time('N') /* (same as above) */
|
||||
say time('Normal') /* (same as above) */
|
||||
say time('nitPick') /* (same as above) */
|
||||
|
||||
say time('C') /* hh:mmam or hh:mmpm (hh is 0 --> 12). */
|
||||
say time('Civil') /* (same as above) */
|
||||
|
||||
say time('L') /* hh:mm:ss.ffffff (hh is ---> 23). */
|
||||
say time('Long') /* (same as above) */
|
||||
3
Task/System-time/Racket/system-time-1.rkt
Normal file
3
Task/System-time/Racket/system-time-1.rkt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket
|
||||
(require racket/date)
|
||||
(date->string (current-date))
|
||||
2
Task/System-time/Racket/system-time-2.rkt
Normal file
2
Task/System-time/Racket/system-time-2.rkt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#lang racket
|
||||
(current-seconds)
|
||||
1
Task/System-time/Retro/system-time.retro
Normal file
1
Task/System-time/Retro/system-time.retro
Normal file
|
|
@ -0,0 +1 @@
|
|||
time putn
|
||||
10
Task/System-time/Ruby/system-time.rb
Normal file
10
Task/System-time/Ruby/system-time.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
t = Time.now
|
||||
|
||||
# textual
|
||||
puts t # => Wed Aug 05 20:14:50 -0400 2009
|
||||
|
||||
# epoch time
|
||||
puts t.to_i # => 1249517690
|
||||
|
||||
# epoch time with fractional seconds
|
||||
puts t.to_f # => 1249517690.74388
|
||||
2
Task/System-time/SNOBOL4/system-time.sno
Normal file
2
Task/System-time/SNOBOL4/system-time.sno
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
OUTPUT = DATE()
|
||||
END
|
||||
1
Task/System-time/Scala/system-time.scala
Normal file
1
Task/System-time/Scala/system-time.scala
Normal file
|
|
@ -0,0 +1 @@
|
|||
println(new java.util.Date)
|
||||
2
Task/System-time/Scheme/system-time.ss
Normal file
2
Task/System-time/Scheme/system-time.ss
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(use posix)
|
||||
(seconds->string (current-seconds))
|
||||
7
Task/System-time/Seed7/system-time.seed7
Normal file
7
Task/System-time/Seed7/system-time.seed7
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "time.s7i";
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
writeln(time(NOW));
|
||||
end func;
|
||||
1
Task/System-time/Smalltalk/system-time-1.st
Normal file
1
Task/System-time/Smalltalk/system-time-1.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
DateTime now displayNl.
|
||||
1
Task/System-time/Smalltalk/system-time-2.st
Normal file
1
Task/System-time/Smalltalk/system-time-2.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
DateAndTime now
|
||||
1
Task/System-time/Standard-ML/system-time.ml
Normal file
1
Task/System-time/Standard-ML/system-time.ml
Normal file
|
|
@ -0,0 +1 @@
|
|||
print (Date.toString (Date.fromTimeLocal (Time.now ())) ^ "\n")
|
||||
2
Task/System-time/TI-89-BASIC/system-time.ti-89
Normal file
2
Task/System-time/TI-89-BASIC/system-time.ti-89
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
■ getTime() {13 28 55}
|
||||
■ getDate() {2009 8 13}
|
||||
3
Task/System-time/TUSCRIPT/system-time.tuscript
Normal file
3
Task/System-time/TUSCRIPT/system-time.tuscript
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$$ MODE TUSCRIPT
|
||||
time=time()
|
||||
PRINT time
|
||||
1
Task/System-time/Tcl/system-time-1.tcl
Normal file
1
Task/System-time/Tcl/system-time-1.tcl
Normal file
|
|
@ -0,0 +1 @@
|
|||
puts [clock seconds]
|
||||
1
Task/System-time/Tcl/system-time-2.tcl
Normal file
1
Task/System-time/Tcl/system-time-2.tcl
Normal file
|
|
@ -0,0 +1 @@
|
|||
puts [clock format [clock seconds]]
|
||||
3
Task/System-time/UNIX-Shell/system-time.sh
Normal file
3
Task/System-time/UNIX-Shell/system-time.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
date # Thu Dec 3 15:38:06 PST 2009
|
||||
|
||||
date +%s # 1259883518, seconds since the epoch, like C stdlib time(0)
|
||||
5
Task/System-time/Ursala/system-time.ursala
Normal file
5
Task/System-time/Ursala/system-time.ursala
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#import cli
|
||||
|
||||
#cast %s
|
||||
|
||||
main = now 0
|
||||
2
Task/System-time/Vala/system-time.vala
Normal file
2
Task/System-time/Vala/system-time.vala
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
var now = new DateTime.now_local();
|
||||
string now_string = now.to_string();
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue