| Bytes | Lang | Time | Link |
|---|---|---|---|
| 038 | Swift 6 Linux w/ C interop | 230712T030134Z | macOSist |
| 015 | Ruby | 241003T183441Z | Jordan |
| 015 | TIBasic TI84 | 231224T164333Z | MarcMush |
| 011 | Uiua | 231224T062252Z | chunes |
| 030 | Minecraft Function | 230731T221811Z | LostXOR |
| 045 | Commodore BASIC Commodore C64/C128 | 230627T130552Z | Shaun Be |
| 026 | Racket | 230704T090515Z | Ed The & |
| 028 | ARM Thumb machine code + Linux syscalls | 230715T082142Z | landfill |
| 005 | Vyxal | 230628T190005Z | The Empt |
| 002 | ><> t0.5 | 230710T001319Z | Jo King |
| 112 | ELF x86/x64 | 230709T215559Z | engineer |
| 022 | TIBasic TI84+ | 230629T194802Z | Youserna |
| 038 | Python 2 | 230629T152752Z | Dadsdy |
| 019 | Javascript | 230626T060043Z | Dadsdy |
| 004 | Japt | 230626T154530Z | Shaggy |
| 005 | Vyxal j | 230629T102903Z | emanresu |
| 005 | 05AB1E | 230629T095615Z | Kevin Cr |
| 019 | GBZ80 machine code DMG mode | 230629T000602Z | SNBeast |
| 004 | *><> | 230628T125711Z | Bee H. |
| 017 | PHP | 230627T101931Z | Kaddath |
| 021 | Wolfram Language Mathematica | 230628T075058Z | alephalp |
| 013 | QBasic | 230627T173519Z | DLosc |
| 016 | PowerShell | 230627T171908Z | user3141 |
| 021 | Julia 1.0 | 230626T181541Z | Ashlin H |
| 039 | Python 3 | 230626T053727Z | AnttiP |
| 019 | Perl 5 | 230627T115304Z | Kjetil S |
| 005 | Jelly | 230626T162614Z | Jonathan |
| 036 | Nim | 230627T092414Z | Adam |
| 045 | C# Visual C# Interactive Compiler | 230627T073546Z | LiefdeWe |
| 093 | simply | 230627T001307Z | Ismael M |
| nan | 230626T050135Z | Dadsdy | |
| 050 | Lua | 230626T214642Z | bluswimm |
| 006 | Bash + iputils | 230626T165924Z | c-- |
| 010 | Charcoal | 230626T185136Z | Neil |
| 009 | Batch | 230626T104431Z | Neil |
| 014 | x8616 machine code | 230626T181213Z | 640KB |
| 003 | MacOS shell | 230626T171853Z | Digital |
| 015 | GFABasic 3.51 Atari ST | 230626T153532Z | Arnauld |
| 006 | Pyth | 230626T142859Z | CursorCo |
| 011 | shell + GNU/Linux core utils | 230626T102425Z | matteo_c |
| 007 | MATL | 230626T091633Z | Luis Men |
| 023 | Arturo | 230626T082954Z | chunes |
| 025 | R | 230626T064810Z | pajonk |
| 030 | C gcc | 230626T065430Z | dingledo |
| nan | Desmos | 230626T062343Z | Aiden Ch |
| 018 | Factor | 230626T060015Z | chunes |
Swift 6 (Linux w/ C interop), 41 40 39 38 bytes
import Glibc
while sleep(1)<1{print()}
Prints a newline every second. Needs import Darwin instead of import Glibc on macOS.
Swift 6 (pure), 55 bytes
while 0<1{print(try await Task.sleep(for:.seconds(1)))}
TI-Basic (TI-84), 15 bytes
startTimer
Disp Ans
Repeat checkTmr(Ans
End
prgmA
needs to be stored in prgmA for the recursion
based on and improved over Yousername's answer
Uiua, 11 bytes
⍥(&pπ&sl1)∞
Doesn't work online, but works locally.
⍥(&pπ&sl1)∞
⍥( )∞ # infinite loop
&sl1 # sleep for one second
&pπ # print pi
Minecraft Function, 30 bytes
say a
schedule function a:b 1s
Must be run as a function named b in a data pack named a.
It prints [Server] a to chat once per second.
The first command simply says a, and the second command schedules the function to execute again in one second.
Commodore BASIC (Commodore C64/C128, C16/+4, VIC-20, PET), ~61 ~45 tokenised BASIC bytes
0printti$:b=val(ti$)+1
1ifval(ti$)<bthen1
2goto
This works by using the Commodore TI$ system variable. Firstly, this outputs the value of TI$ to the screen (which is in HHMMSS format). It then take the value of TI$ as a number and add one to it. It then waits until the current numeric value of TI$ is no longer a less significant number than the B variable, and then we GOTO line 0 to output the new value of TI$ to the screen. This continues until the STOP key is pressed, which will break the program (it may be continued with the CONT command).
Screenshot reflects an older iteration of this entry.
Racket, 43 37 28 26 bytes
Changelog
- Thanks to @Dadsdy for the
-2bytes. - The
-4bytes comes from converting#lang racketto#!racket. - Another
-9as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes. - I just learnt about Racket's
doloop!-2bytes! 🎉
Code
(do()(#f)(write(sleep 1)))
Explanation
We create a do loop that runs infinitely. Since we used #f (false) in dos second argument, the loop won't terminate as it will only terminate if there is a #t value.
If we were to expand this out and make it more readable, it would look like this:
(do () (#f)
; (sleep 1) doesn't return anything, so #<void> will be printed.
(write (sleep 1)))
The do loop acts a bit similar to JavaScript's while loop:
while (!false) {
// ...
}
ARM Thumb machine code + Linux syscalls, 28 bytes
00: 2202 movs r2, #2 // 2 bytes
02: 2704 movs r7, #4 // write()
04: 2001 movs r0, #1 // stdout
06: a104 adr r1, #0x18 // pointer to 0x18 "!\n"
08: df00 svc #0 // syscall write(1, "!\n", 2)
0a: 27a2 movs r7, #162 // nanosleep()
0c: a001 adr r0, #0x14 // pointer to 0x14
0e: 2100 movs r1, #0 // NULL
10: df00 svc #0 // syscall nanosleep(&{1, 2593}, 0)
12: e7f6 b.n #0x02 // jump to 0x02, r2 won't have changed
14: 0000 0001 .word 1 // 1 second
18: 0000 0a21 .word 0x0a21 // "!\n" or 2593 nanoseconds
Vyxal , 5 Bytes
{1¨w,
><> -t0.5, 2 bytes
1n
><> has an extra flag to set the time between ticks, presumably to help with debugging. This code simply outputs a 1 every 2*0.5 seconds.
ELF (x86/x64, Linux), 112 bytes
Prints 'A' about once per second, indefinitely.
00000000: 7f45 4c46 fec0 505f e81b 0000 0000 0000 .ELF..P_........
00000010: 0200 3e00 0000 0000 0400 0000 4100 0000 ..>.........A...
00000020: 3800 0000 0000 0000 5e40 80c6 3f50 5a0f 8.......^@..?PZ.
00000030: 0504 2256 eb32 3800 0100 0000 0500 0000 .."V.28.........
00000040: 0000 0000 0000 0000 0000 0000 4100 0000 ............A...
00000050: 0100 0000 0000 0000 7000 0000 0000 0000 ........p.......
00000060: 7000 0000 0000 0000 5faf 0f05 eb96 0000 p......._.......
Try it online! (Prints 60 A's before TIO kills the process)
Explanation
The file abuses a lot of undefined behavior within the Linux ELF loader; the kernel is able to make a lot of (correct) assumptions when certain fields are not the right value. Here is the full NASM source.
Basically, the executable is just an ELF header, a program header (partially merged into the ELF header), and the actual program (which is spread throughout the two headers so that it doesn't take up any additional space). The full program calls sys_write(stdout, "A", 1), then sys_nanosleep({tv_sec=1, tv_nsec=112}, <nonsense valid pointer>), and then loops back to the start.
TI-Basic (TI-84+), 22 bytes
startTmr
While 1
If checkTmr(Ans:Then
Disp Ans
startTmr
End
End
Javascript, 22 20 19 Bytes
Thanks to @Kaiido for -2 Bytes Thanks to @Elias Holzmann for -1 Bytes
setInterval({},1e3)
Japt, 7 4 bytes
Outputs a ReferenceError.
Any lowercase letter word work instead of the second i.
A³ii
Test it (Open your browser's console)
Vyxal j, 5 bytes
⁽kNḞU
Don't Try it Online! - it doesn't work there.
This one's kind of hilarious. It creates an infinite list of times, and then uniquifies them. The j flag is necessary due to how Vyxal handles printing infinite lists.
Ḟ # Generate an infinite list from...
⁽ # A function that returns
kN # The current time of day (hh:mm:ss)
U # Get unique values
05AB1E, 5 bytes
[₄=.W
Keeps printing 1000\n every second.
Explanation:
[ # Start an infinite loop:
₄ # Push 1000
= # Print it with trailing newline (without popping)
.W # Pop and sleep that many milliseconds
GBZ80 machine code (DMG mode): 19 bytes
21 0F FF 3E 01 E0 FF 06 78 76 70 05 20 FB 2F E0 47 18 F4
Assembly:
Entrypoint:
ld hl, $ff0f
ld a, $01
ldh [$ffff], a ; only accept vblank interrupts
.outerLoop:
ld b, 120
.innerLoop:
db $76 ; directly encoded halt. saves one byte over "halt" in my assembler.
; since by deliberate design IE & IF is sometimes not zero here, we encounter the halt bug. fortunately, "ld [hl], b" is a one byte instruction whose duplication is, excluding time, transparent (with exceptions that would be familiar to those who encounter them)
ld [hl], b ; discard the pending interrupt every other pass (even parity)
dec b
jr nz, .innerLoop
cpl
ldh [$ff47], a ; invert the palette
jr .outerLoop
This is just counting vblanks, with some mangling to save a single byte from not loading an immediate to clear the vblank interrupt flag. The effect produced every second is inverting the screen colors. This does not work in CGB mode because the register for the DMG background palette does nothing in CGB mode.
*><>, 4 bytes
Prints "10" on startup, and once every second
a:nS
Explanation
a # Push 10 onto the stack
: # Duplicate it
n # Pop a value off the stack, and print it as a decimal number
S # Pop a value off the stack, and sleep for 100ms * the popped value
PHP, 22 21 17 bytes
for(;;a)sleep(1);
I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course
EDIT: saved 1 byte by echoing the falsey result of sleep, it works because sleep returns zero instead of false which would have lead to an empty string
EDIT 2: stole the suggestion from this JS answer by triggering a warning instead of an echo
Wolfram Language (Mathematica), 21 bytes
Dynamic@Floor@Clock@2
A dynamic object that alternates between 0 and 1 every second. This only works in the Notebook interface, so no TIO link.
Wolfram Language (Mathematica), 23 bytes
Echo@True~While~Pause@1
Prints True every second.
QBasic, 13 bytes
I'm not sure how rules-bendy to get, but here's the shortest possible version:
?
SLEEP 1
RUN
You can try it at Archive.org.
Explanation
? ' Print a blank line
SLEEP 1 ' Wait 1 second
RUN ' Restart the program
Once the screen is filled up with blank lines, you won't be able to see new output happening, and you can't select the outputted text. So here's a 15-byte version that will be visually different each time something is printed:
?0; ' Print 0 without a newline
SLEEP 1 ' Wait 1 second
RUN ' Restart the program
PowerShell, 16 bytes
Paste it into a PS console (Windows or Core) (not using TIO because that will only show the output once the script is stopped):
for(){sleep 1;1}
Will print 1 every second until Ctrl-C is pressed.
Nothing remarkable, just for the sake of completeness when it comes to languages.
Julia 1.0, 24 21 bytes
!x=!show(sleep(1))
!0
-3 bytes thanks to ovs: improve recursion, and redefine an operator (An argument has to be passed to it, but this can be ignored by the function)
Jelly, 5 bytes
1œSṄ¿
A full program which prints 1 and a newline and then after (just over) one second has elapsed prints another, then repeats this step forever.
It's "just over" as it takes some time to do the work. The first pause could take more than 1 second on slow hardware as Jelly has to initialise Python, and itself (create an interpreter, import some cruft, etc.) and parse the code. Subsequent pauses are unlikely to be over the 1.01 second threshold however as it just needs to check that the result is truthy and print to STDOUT.
Try it online! (TIO does not output anything as a program runs, but kill it while in flight and take a look; killing within a second should give a single 1 in the "Output" section, leaving it running longer should give more outputted 1s for each second that passed.)
How?
1œSṄ¿ - Main Link: no arguments
1 - set the left argument to one
¿ - while...
Ṅ - ...condition: print {left=1} and a newline, and yield {left=1}
œS - ...action: sleep for {implicit right=left=1} seconds and yield {left=1}
Replace Ṅ with Ȯ for no newlines.
C# (Visual C# Interactive Compiler), 45 bytes
Nothing special
for(;;){Thread.Sleep(1000);Console.Write(1);}
simply, 93 bytes
Outputs a 9x9 image with a random color, every 999 milliseconds - which is within the 10ms error range.
%C=run!CANVAS->init(9,9)run%C->ontick(fn()=>run%C->fillRect(0 0 9 9run%C->getRandomColor)999)
It does exactly what it's supposed to.
Ungolfed
This code does exactly the same.
$fn = anonymous function() {
$color = call %canvas->getRandomColor();
call %canvas->fillRect(0, 0, 9, 9, $color);
};
%canvas = call !CANVAS->init(9, 9);
call %canvas->ontick($fn, 999);
I'm too lazy to write a full English-like version.
If you need more information, to confirm it does do what it's supposed to do, just add this after the code:
// Golfed version:
call %C->showDebug();
// Ungolfed version:
call %canvas->showDebug();
To make sure it is running, just check that the (manually) underlined value changes at a rate of ~1 second:

That value represents the number of frames that were actually drawn.
By default, the code avoids re-drawing the canvas if there were no updates.
And each call to fillRect will trigger a single update.
You can replace ontick with onframe or onclick to verify that the value really represents what I've said.
(,), 60 62 61 Chars or \$61\log_{256}(3)\approx\$ 12.09 Bytes
((),((()))((())))((()),((())))(,((()),(),(),,((())),()),,,())
((),((()))((()))) Sets variable 1 to -2.
((()),((()))) sets variable -2 (time) to itself. (AKA setting the current time to 0)
(, Start of loop
((()),(),(),,((())),()) If variable -2 (time) is at least 1, reduce it by 1 and output 1\n
,,,()) Loop forever
First solution sometimes had the second output less than a second after the first.
Lua, 50 bytes
o=os.time::a::t=o()repeat until t<o()print()goto a
A platform independent solution. You can make this shorter by using os.execute, but that solution is both platform dependent and not very interesting.
Bash + iputils, 6 bytes
ping 0
send ICMP ECHO_REQUEST to 0 (127.0.0.1) once per second.
Bash + procps-ng, 8 bytes
free -s1
Display amount of free and used memory in the system with one second between outputs.
Charcoal, 10 bytes
RWφψPI¬ΣKK
Try it online! Link is to verbose version of code. Uses control codes to toggle the top left corner between 1 and 0, so on TIO you need to let it run for a few seconds and then interrupt it to see the control codes and 1s and 0s. Explanation:
RWφψ
Repeat indefinitely, showing the current canvas with a 1000ms delay on each repeat.
PI¬ΣKK
Toggle the current character between 1 and 0.
Batch, 15 13 9 bytes
ping -t 0
After some initial output, outputs the following every second:
PING: transmit failed. General failure.
Edit: Saved 4 bytes thanks to @c--.
Previous 15-byte solution:
timeout/t 1
%0
Repeatedly outputs the following:
C:\Users\Neil>timeout/t 1
Waiting for 1 seconds, press a key to continue ...0
C:\Users\Neil>262205.bat
When output is to the screen, the cursor is moved so that the 0 overwrites the 1.
x86-16 machine code, PC DOS, 14 bytes
00000000: b42c cd21 3ac6 74fa 8ac6 cd29 ebf4 .,.!:.t....)..
Listing
B4 2C MOV AH, 2CH ; DOS API get system time function
SEC_LOOP:
CD 21 INT 21H ; Read time: DH = seconds
3A C6 CMP AL, DH ; second changed?
74 FA JE SEC_LOOP ; continue polling if not
8A C6 MOV AL, DH ; save new second
CD 29 INT 29H ; write AL to console
EB F4 JMP SEC_LOOP ; loop indefinitely
A standalone executable DOS COM program. Spams the DOS time function and writes the corresponding ASCII codepoint for the number of seconds.
Several minutes later...
MacOS shell, 3
top
On the Mac, top's default refresh period is 1 sec.
Linux shell, 7
top -d1
Unfortunately on Linux, top's default refresh period is more like 2 secs, so we need an extra 4 bytes.
Since this is just one command, both variants are shell-agnostic.
GFA-Basic 3.51 (Atari ST), 15 bytes
A manually edited listing in .LST format. All lines end with CR, including the last one.
DO
?0
PA 50
LO
which expands to:
DO
PRINT 0
PAUSE 50
LOOP
We could use DELAY 1 instead of PAUSE 50. Unfortunately, the shortest unambiguous abbreviation of DELAY is DELA.
Output
After 5 seconds:
Pyth, 6 bytes
#.d
.j
Explanation
# # loop forever until error (no error will occur)
.j # imaginary number i, printed
.d # sleep for abs(i) seconds
It may seem weird that I have to sleep for \$|i|\$ seconds, why not just 1? While that would save a byte, unfortunately .d1 is a predefined macro which returns the amount of time which has passed since the program started, which is not really useful for this challenge.
shell + GNU/Linux core utils, 11 bytes
watch -n1 w
A bit of a boring answer.
MATL, 7 bytes
`@D1Y.T
This displays the natural numbers in order. Try at MATL online!
How it works
` % Do...while
@ % Push iteration index, starting at 1
D % Display
1 % Push 1
Y. % Pause for that many seconds
T % Push true. This is used as loop condition, causing an infinite loop
% End (implicit)
Arturo, 23 bytes
whileø[1:s>>{a}1pause]
whileø[ ; start infinite loop (while loop with null for condition)
1:s ; push duration of 1 second to stack
>>{a}1 ; create/overwrite file named a
pause ; pause execution for one second (which we left on the stack earlier)
] ; end while
R, 27 25 bytes
Edit: -2 bytes thanks to @Dominic van Essen.
repeat show(Sys.sleep(1))
This works well on my local machine, but TIO accumulates output until it finishes execution, so you don't see the progress.
Desmos, 5+3+3+2=13 bytes
Ticker expression (5 bytes)
a->-a
Ticker repeat delay (3 bytes)
999
Main expressions (3 bytes)
a=1
2 bytes for "file boundaries" (treat each expression as a separate "file"; there are 3 "files", so there are two "file boundaries", as per this comment)
To run, click the ticker icon (the metronome) near the top left of the screen. This switches the variable a between the values 1 and -1 every 999 milliseconds. While this isn't outputting onto the console or stdin in the traditional sense, you can still clearly see the code switching between the 1 and the -1, which hopefully emulates outputting close enough.
Factor, 18 bytes
[ .s ] 1e9 every .
every calls a function each time a duration has passed. If every is not given a duration such as 1 seconds, and instead given a number, it defaults to nanoseconds. Thus, one billion (or 1e9) means one second. .s simply prints the contents of the data stack without consuming them, which in this case will print the timer object every uses to do its thing. The . at the end is necessary to satisfy the stack effect checker by removing the item on the data stack (because Factor programs must end with an empty stack), even though it will never be reached.



