all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View 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)]]

View file

@ -0,0 +1,2 @@
---
note: Programming environment operations

View 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))

View file

@ -0,0 +1,2 @@
$ awk 'BEGIN{print systime(),strftime()}'
1242401632 Fri May 15 17:33:52 2009

View 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;

View 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');

View file

@ -0,0 +1 @@
display dialog (current date)

View file

@ -0,0 +1,2 @@
FormatTime, t
MsgBox,% t

View file

@ -0,0 +1 @@
MsgBox(0,"Time", "Year: "&@YEAR&",Day: " &@MDAY& ",Hours: "& @HOUR & ", Minutes: "& @MIN &", Seconds: "& @SEC)

View file

@ -0,0 +1 @@
PRINT TIMER

View file

@ -0,0 +1 @@
PRINT TIME$

View file

@ -0,0 +1 @@
PRINT TIME$

View file

@ -0,0 +1 @@
PRINT RIGHT$(TIME$,8)

View file

@ -0,0 +1,2 @@
date /t
time /t

View file

@ -0,0 +1 @@
echo %DATE% %TIME%

View 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 ;
}

View 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;
}

View 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))

View 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))

View file

@ -0,0 +1 @@
Stdout(Clock.now.span.days / 365).newline;

View file

@ -0,0 +1 @@
PrintLn(FormatDateTime('dd mmmm yyyy hh:mm:ss', Now));

View file

@ -0,0 +1 @@
lblDateTime.Caption := FormatDateTime('dd mmmm yyyy hh:mm:ss', Now);

View file

@ -0,0 +1 @@
println(timer.now())

View file

@ -0,0 +1,2 @@
1> os:timestamp().
{1250,222584,635452}

View 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}}

View file

@ -0,0 +1,3 @@
USE: calendar
now .

View file

@ -0,0 +1,6 @@
fansh> DateTime.nowTicks
351823905158000000
fansh> DateTime.now
2011-02-24T00:51:47.066Z London
fansh> DateTime.now.toJava
1298508885979

View 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

View 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)

View 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

View file

@ -0,0 +1 @@
Taskbar

View 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
}

View file

@ -0,0 +1,2 @@
def nowMillis = new Date().time
println 'Milliseconds since the start of the UNIX Epoch (Jan 1, 1970) == ' + nowMillis

View 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

View 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

View 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)

View 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

View file

@ -0,0 +1 @@
Date now println

View file

@ -0,0 +1 @@
2008-08-26 00:15:52 EDT

View file

@ -0,0 +1,2 @@
6!:0 ''
2008 1 23 12 52 10.341

View file

@ -0,0 +1,2 @@
6!:0 'YYYY-MM-DD hh:mm:ss.sss'
2009-08-26 10:38:53.171

View file

@ -0,0 +1,5 @@
public class SystemTime{
public static void main(String[] args){
System.out.format("%tc%n", System.currentTimeMillis());
}
}

View 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
}
}

View file

@ -0,0 +1,3 @@
console.log(new Date()) // => Sat, 28 May 2011 08:22:53 GMT
console.log(Date.now()) // => 1306571005417 // Unix epoch

View 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

View file

@ -0,0 +1,2 @@
print time
print time/300;"s since last reboot"

View 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

View file

@ -0,0 +1 @@
print(os.date())

View file

@ -0,0 +1 @@
datestr(now)

View file

@ -0,0 +1 @@
clock

View 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

View file

@ -0,0 +1,2 @@
Print[DateList[]]
Print[AbsoluteTime[]]

View 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();

View 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.

View file

@ -0,0 +1,2 @@
import java.text.SimpleDateFormat
say SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS").format(Date())

View 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;;

View 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());
}

View file

@ -0,0 +1 @@
NSLog(@"%@", [NSDate date]);

View file

@ -0,0 +1 @@
NSLog(@"%@", [NSCalendarDate calendarDate]);

View 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}}

View file

@ -0,0 +1 @@
system("date")

View file

@ -0,0 +1 @@
echo time(), "\n";

View file

@ -0,0 +1 @@
echo microtime(), "\n";

View 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

View 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. */

View 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.

View file

@ -0,0 +1 @@
say DateTime.now;

View file

@ -0,0 +1 @@
print scalar localtime, "\n";

View 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);

View file

@ -0,0 +1,5 @@
use DateTime;
my $dt = DateTime->now;
my $d = $dt->ymd;
my $t = $dt->hms;
print "$d $t\n";

View file

@ -0,0 +1,4 @@
use POSIX qw(strftime);
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
print "$now_string\n";

View 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.

View file

@ -0,0 +1 @@
print time;

View file

@ -0,0 +1 @@
(stamp)

View file

@ -0,0 +1 @@
Get-Date

View file

@ -0,0 +1 @@
[DateTime]::Now

View 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

View file

@ -0,0 +1,2 @@
import time
print time.ctime()

View 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

View file

@ -0,0 +1 @@
Sys.time()

View file

@ -0,0 +1,2 @@
now
print rejoin [now/year "-" now/month "-" now/day " " now/time]

View 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) */

View file

@ -0,0 +1,3 @@
#lang racket
(require racket/date)
(date->string (current-date))

View file

@ -0,0 +1,2 @@
#lang racket
(current-seconds)

View file

@ -0,0 +1 @@
time putn

View 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

View file

@ -0,0 +1,2 @@
OUTPUT = DATE()
END

View file

@ -0,0 +1 @@
println(new java.util.Date)

View file

@ -0,0 +1,2 @@
(use posix)
(seconds->string (current-seconds))

View file

@ -0,0 +1,7 @@
$ include "seed7_05.s7i";
include "time.s7i";
const proc: main is func
begin
writeln(time(NOW));
end func;

View file

@ -0,0 +1 @@
DateTime now displayNl.

View file

@ -0,0 +1 @@
DateAndTime now

View file

@ -0,0 +1 @@
print (Date.toString (Date.fromTimeLocal (Time.now ())) ^ "\n")

View file

@ -0,0 +1,2 @@
■ getTime() {13 28 55}
■ getDate() {2009 8 13}

View file

@ -0,0 +1,3 @@
$$ MODE TUSCRIPT
time=time()
PRINT time

View file

@ -0,0 +1 @@
puts [clock seconds]

View file

@ -0,0 +1 @@
puts [clock format [clock seconds]]

View 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)

View file

@ -0,0 +1,5 @@
#import cli
#cast %s
main = now 0

View 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