[Question]
  [
I'd like you to build me a clock that displays time in this format:
```
18 ----------
19 --------------------------------------------------
```
This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.
# To clarify
* The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It *may not* be supplied as input.
* At `18:00`, the top line is just `18` (Trailing spaces allowed but not required)
* At `18:59`, the bottom line is `19 -`
* The hours < 10 are either pre-padded with a `0` (`01 -----`) or right-aligned ( `1 -----`). A left-aligned single digit is not allowed, not even if the dashes start at the right place (`1 -----` is invalid).
* The clock should display the hours in a 24h-format.
* Although it's called the 24h format, there is not actually a `24` on it. During the 23rd hour, the second line starts with `00` or  `0`.
* The display needs to be updated at least once a minute, but that doesn't have to happen at exactly `00` seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.
# Input
None.
# Output
* As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
* The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.
# Additional rules
* [Standard loopholes](http://meta.codegolf.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden
* [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), shortest answer in bytes wins.
  
[Answer]
# TI-Basic, 94 bytes
```
" 
Repeat 99<length(Ans
Ans+"-
End
Ans→Str1
Repeat 0
getTime
ClrDraw
Ans{Ans(1)≠24,1,1
Text(0,0,Ans(1),sub(Str1,1,1+Ans(2
Text(6,0,Ans(1)+1,sub(Str1,1,61-Ans(2
End
```
Relatively straightforward. That's a string with one space at the beginning. The hours are right-aligned. This only works on TI-84+ calculators since the TI-83 does not have an internal clock.
Edit: Thanks @kundor for noticing that I didn't close the last loop. Fixed now (+2 bytes).
Edit #2: First hour should be zero, not twenty-four. Corrected at a cost of +14 bytes.
[Answer]
## Batch, 197 bytes
```
@echo off
set/ah=100+%time:~0,2%,m=1%time:~3,2%
cls
call:l
set/ah=(h-3)%%24+100,m=260-m
call:l
timeout/t>nul 60
%0
:l
set s=%h:~1% 
for /l %%i in (101,1,%m%)do call set s=%%s%%-
echo %s%
```
Note: 10th line has a trailing space. For me, `%time%` formats hours with a leading space but minutes with a leading zero. I decided a leading zero was an easier output format, since all I have to do for that is to add 100 hours and remove the first digit. Minutes are trickier as `08` or `09` will cause octal parse errors, so I prefix a `1` effectively adding 100 minutes, adjusting for this by offsetting the loop appropriately, which is a byte shorter than subtracting the 100.
[Answer]
## Python 3.6, ~~110~~ ~~114~~ 112 bytes
```
from time import*
while[sleep(9)]:h,m=localtime()[3:5];print('\n'*50+'%2d '%h+'-'*m+f'\n{-~h%24:2} '+'-'*(60-m))
```
This uses the new f-string formatting to save one byte (`f'\n{h+1:2} '` vs `'\n%2d '%(h+1)`.) You can change `[sleep(9)]` to  `1` to save 8 bytes, but then it just spams the screen.
Saved one byte changing `while 1:...;sleep 60` to `while[sleep(60)]:...`, thanks to TuukkaX.
I had to use 5 more bytes to get the next hour displayed after 23 to be 0, instead of 24, as OP just commented. :-(
Recovered one byte by only sleeping 9 seconds instead of 60.
Saved two bytes using a bit-fiddling to shorten `(h+1)%24`, borrowed from [Value Ink's Ruby answer](https://codegolf.stackexchange.com/a/107148/18314).
[Answer]
# Ruby, ~~98~~ ~~95~~ 91 bytes
Updates every 5 seconds. Only works in Unix-style terminals.
```
loop{t=Time.now;puts`clear`+"%02d %s
%02d "%[h=t.hour,?-*m=t.min,-~h%24]+?-*(60-m);sleep 5}
```
Windows command prompt version, ~~95~~ 92 bytes:
```
loop{t=Time.now;puts"\e[H\e[2J%02d %s
%02d "%[h=t.hour,?-*m=t.min,-~h%24]+?-*(60-m);sleep 5}
```
[Answer]
# [Perl 6](https://perl6.org), 113 bytes
```
loop {$_=DateTime.now;.put for |('' xx 30),|([\+](.hour,1)».fmt('%2s')Z('-' Xx[\-](.minute,60)».abs));sleep 60}
```
[Try it once](https://tio.run/nexus/perl6#FcrLCoJAFADQX7lQMTOkgxW4SNr1AS1aRBphccWBecg8aEL9snb9mNnmrM7JGiUccqHphnHfot5Dj1H4ERYg0YPwYIMGo@V75omTNKaDfnk/HGuPZ6GQa/MqeBc8NMbCQAmBGGGXsWSgZbW@Ud6aYJMN@354ozwlq60j7EpJSuASyyqdhxI6eEzy7J/qh2OscBKxgzwbp@kH "Perl 6 – TIO Nexus") with a one second timeout.
[Or try an altered version](https://tio.run/nexus/perl6#hZDBSsQwEIbvfYofdiUJdktXYQ8uvfkIHsRdWdLt1BabpDSpLbg@mTdfrKYtgrKKA7n8M/PN/2dYHpDgVjq6KxVF2nRbfKsF0obkM0oH0/qXwxWEypga1qAjHKX2TWo8IAgm/TUIxr3lIfmDusDRKEXaUTZBPcgV0o03RtqxkPqJkJLriL7gpdF25Ea1X8hNgxNnDH2P61iEJ77bXz7yqDBtE67Fx3uUK8fZxZVl4oGzFcN9v9uv/IQqdeso3MTjkEytENvZra2IamxinNU/br00WlKmIbzIqqXJpv/UKEHl8zccN/NVvhYQE1BmGSRm9QdvSm5/jf42DJ8 "Perl 6 – TIO Nexus") that outputs the result of running for several hours.
## Expanded:
```
loop {                  # keep repeating forever
  $_ = DateTime.now;    # assign an object representing the current time
    .put                # print with trailing newline
                        # ( adds a space between numbers and dashes )
  for                   # for each of the following
    |(                  # make it a slip so that it is all part of one list
      '' xx 30          # 30 empty strings (30 empty lines)
    ),
    |(
        [\+](           # triangle produce
          .hour,        # the hour
          1             # the hour plus one
        )».fmt( '%2s' ) # both formatted to two element string ( space padded )
      Z                 # zipped with
        (
            '-'         # a dash
          Xx            # cross (X) using string repeat (x) operator
            [\-](       # triangle produce
              .minute,  # the minute
              60        # the minute minus 60
            )».abs      # absolute value of both
        )
    );
  sleep 60              # wait until the next minute
}
```
[Answer]
# QBasic, ~~120~~ ~~127~~ 121 bytes
~~Don't run this for very long or your laptop will catch fire.~~ Now 99.several9s% more CPU-efficient.
```
CLS
m=TIMER\60
h=m\60
m=m MOD 60
FOR i=1TO 2
?USING"## ";h MOD 24;
FOR j=1TO m
?"-";
NEXT
?
h=h+1
m=60-m
NEXT
SLEEP 1
RUN
```
### Ungolfed and explanation
```
DO
    CLS
    totalMinutes = TIMER \ 60
    hour = totalMinutes \ 60
    minute = totalMinutes MOD 60
    FOR row = 1 TO 2
        PRINT USING "## "; hour MOD 24;
        FOR j = 1 TO minute
            PRINT "-";
        NEXT j
        PRINT
        hour = hour + 1
        minute = 60 - minute
    NEXT row
    SLEEP 1
LOOP
```
We start by clearing the screen, then get the current hours and minutes from `TIMER`, which returns the number of seconds since midnight. 
This is the first time I've tried `PRINT USING`, so I was delighted to discover that it doesn't suffer from the usual QBasic quirk that positive numbers are printed with a leading space. `##` as the format specifier ensures that single-digit numbers are right-aligned and padded with a space, as required. We have to use a loop for the hyphens, unfortunately, since QBasic does not have a string repetition function. (If I'm mistaken, please let me know!)
All the `PRINT` statements end with `;` to suppress the newline; but after the hyphens, we need a newline; thus, the solitary `?` after the inner `FOR` loop.
The `SLEEP 1` is now necessary. Without it, the screen gets cleared so quickly after printing that it's just a flickering mess. (I used `LOCATE 1` instead of `CLS` at first for that reason, until I realized that `CLS` with `SLEEP` is shorter anyway.) `RUN` restarts the program from the top--the shortest way to get an infinite loop.
[Answer]
## Java 8, 313 300 299 bytes
```
import java.time.*;()->{for(int c=0,h=LocalDateTime.now().getHour(),m=LocalDateTime.now().getMinute(),i;;)if(c>30){c=0;String l="",u,d;for(i=0;i++<60;)l+="-";u=l.substring(0,m);d=l.substring(m);System.out.println((h<10?"0":"")+h+" "+u+"\n"+(h<9?"0":"")+(h+1)+" "+d);}else{c++;System.out.println();}}
```
This only updates every 30 iterations of the while loop. The other 29 iterations just print new lines.
**Updated**
Saved 13 14 bytes due to Kevin Cruijssen's help! Thanks!
[Answer]
## C, ~~176~~ ~~162~~ ~~161~~ ~~160~~ 156 bytes
This is a **gross** abuse of pointers but compiles and runs as specified. Be sure to compile without optimization otherwise you are likely to hit a segfault.
```
main(){int*localtime(),b[9],*t;memset(b,45,60);for(;;)time(&t),t=localtime(&t),usleep(printf("\e[2J%.2d %.*s\n%.2d %.*s\n",t[2],t[1],b,t[2]+1,60-t[1],b));}
```
### Ungolfed:
```
#import<time.h>
main()
{
 int *t,b[60];
 memset(b,45,60);
 for(;;) {
  time(&t);
  t=localtime(&t);
  usleep(printf("\e[2J%.2d %.*s\n%.2d %.*s\n",t[2],t[1],b,t[2]+1,60-t[1],b));
 }
}
```
[Answer]
# JavaScript (ES6), 162 bytes
Updates once per second
```
setInterval(c=>{c.clear(d=new Date,m=d.getMinutes(),h=d.getHours(),H=_=>`0${h++}`.slice(-2)),c.log(H()+` ${'-'.repeat(m)}
${H()} `+'-'.repeat(60-m))},1e3,console)
```
[Answer]
## Python 2, ~~131~~ ~~129~~ 127 bytes
```
from time import*
while[sleep(9)]:exec(strftime("a='%H';b=int('%M')"));print "\n"*30+a+" "+"-"*b+"\n"+`int(a)+1`+" "+"-"*(60-b)
```
saved a byte thanks to @TuukkaX
[Answer]
## C ~~251~~ ~~267~~ 251 bytes
```
 #include<time.h>f(){time_t t;struct tm *t1;h,m,i;while(1){time(&t);t1=localtime(&t);h=t1->tm_hour;m=t1->tm_min;printf("%d ",h);for(i=1;i<=m;i++)printf("-");puts("");printf("%d ",h+1);for(i=0;i<=59-m;i++)printf("-");puts("");sleep(1);system("clear");}}
```
Ungolfed version 
```
#include<time.h>
void f()
{
 time_t t;
 struct tm *t1;
 int h,m,i;
 while(1)
 {
  time(&t);     
  t1=localtime(&t);
  h=t1->tm_hour;
  m=t1->tm_min;
  printf("%d ",h);
  for(i=1;i<=m;i++)
   printf("-");
  puts("");
  printf("%d ",h+1);
  for(i=0;i<=59-m;i++)
   printf("-");
  puts("");    
  sleep(1);
  system("clear");    
 }
}
```
Gets the work done! Can definitely be shortened in some way.
Assume `unistd.h` file is included. 
@Neil Thanks for the info.
@Seth Thanks, for saving 8 bytes.
[Answer]
First time golfing...
# Powershell, 116 bytes (was 122)
```
while($d=date){$f="{0:D2}";$h=$d.Hour;$m=$d.Minute;cls;"$($f-f$h)$("-"*$m)`n$($f-f(++$h%24))$("-"*(60-$m))";Sleep 9}
```
Edit: From @AdmBorkBork's advice, changed Get-Date to date, and Clear to cls, for a saving of 6 bytes.
[Answer]
# PHP, ~~104~~ 105 bytes
```
<? for(;;sleep(6))printf("%'
99s%2d %'-".($m=date(i))."s
%2d %'-".(60-$m).s,"",$h=date(H),"",++$h%24,"");
```
showcase for `printf`´s custom padding characters:  
`"%'-Ns"`=left pad string with `-` to `N` characters.
will print 99 newlines (every 6 seconds) instead of clearing the screen.
First newline must be a single character. So, on Windows, it must be replaced with `\n`.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 41 bytes
*Thanks to @Kundor for noticing a mistake, now corrected*
```
`XxFT"4&Z'@+24\OH&YAO'-'60@*5&Z'-|Y"hhD]T
```
Try it at [MATL online!](https://matl.io/?code=%60XxFT%224%26Z%27%40%2B24%5COH%26YAO%27-%2760%40%2a5%26Z%27-%7CY%22hhD%5DT&inputs=&version=19.7.1) But note that the program is killed after 30 seconds, so it's difficult to catch any changes in the output.
### How it works
```
`           % Do...while
  Xx        %   Clear screen
  FT        %   Push [0 1]
  "         %   For each k in [0 1]
    4&Z'    %     Push current hour
    @+      %     Add k
    24\     %     Modulo 24. This transforms 24 into 0
    OH&YA   %     Convert to base-10 string with 2 digits
    O       %     Push 0. Concatenating with chars will convert this to char,
            %     and char(0) will be displayed as a space
    '-'     %     Push '-'
    60@*    %     Push 60*k
    5&Z'    %     Push current minute
    -|      %     Absolute difference. This gives current minute for k==0,
            %     or 60 minus that for k==1
    Y"      %     Repeat '-' that many times
    hh      %     Concatenate the top three elements into a string
    D      %      Display
  ]         %   End
  T         %   Push true
            % End (implicit). Since the top of the stack contains true, this
            % gives an infinite loop
```
[Answer]
# GameMaker Language, 134 bytes
```
s=" "while 1{s+="-"a=current_hour b=current_minute draw_text(0,0,string(a)+string_copy(s,1,b+1)+"#"+string(a+1)+string_copy(s,0,61-b)}
```
In the settings, you must be ignoring non-fatal errors in order for this to work. Also, in GML, `#` is equivalent to `\n` in most languages.
[Answer]
## AWK, 190 bytes
```
#!/bin/awk -f
func p(x,y,c){printf("%2s ",x)
for(j=0;j<y;j++)printf(c)
print}BEGIN{for(;;){split(strftime("%H %M"),t)
m=t[2]
if(o!=m){p(a,30,"\n")
p(t[1],m,"-")
p((t[1]+1)%24,60-m,"-")}o=m}}
```
Since `AWK` doesn't have a built-in `sleep` function, I simply have it continually check the clock to see if the minute has changed yet. The key thing is that it works... right? :)
[Answer]
## Python 3.5, ~~127~~ 120 ~~117~~ bytes
```
from time import*
while[sleep(9)]:h,m=localtime()[3:5];print('\n'*88,*['%2d '%x+'-'*y+'\n'for x,y in[(h,m),(h+1,60-m)]])
```
[Answer]
# Python, ~~115~~ 113 bytes
saved a couple of bytes thanks to @kundor and @Phlarx
```
import time
while 1:h,m=time.localtime()[3:5];print("\x1b[0;H{:02} {}\n{:02} {} ".format(h,"-"*m,h+1,"-"*(60-m)))
```
[Answer]
## C# *Interactive* (138 Bytes)
```
while(true){var d=DateTime.Now;Console.WriteLine($"{d.Hour:00} {new string('-',d.Minute)}\n{d.Hour+1:00} {new string('-',60-d.Minute)}");}
```
[Answer]
# PHP, ~~112~~ 120 bytes
```
for(;;sleep(9))echo($s=str_pad)($h=date(H),99,"\n",0).$s(" ",1+$m=date(i),"-")."\n".$s(++$h%24,2,0,0).$s(" ",61-$m,"-");
```
As there's no way to clear the screen (that I can find) I had to go with a pile of newlines. Also the question being updated to "at least" once a minute saves a byte with `9` instead of `60`.
edit: @Titus noticed a bug in the padding of the second hour. Fixing it cost 8 bytes.
[Answer]
# Bash (3 and 4): 90 bytes
```
d=(`sed s/./-/g<$0`);let `date +h=%H,m=%M`;echo $h ${d:0:m}'
'$[++h%24] ${d:m}
sleep 5
$0
```
Due to the use of `$0`, this script must be put into a file, not pasted into an interactive bash shell.
The first command sets `$d` to 60 hyphens; it relies on the fact that the first line of this script is 60 characters long. This is three characters shorter than the next best thing I could come up with:
```
d=`printf %060d|tr 0 -`
```
If you don't want this to run your box out of PIDs or memory eventually, you can add `eval` to the beginning of the last line, which would make this 95 bytes.
[Answer]
# BASH, 165 141 155 bytes
```
while :
do
clear
m=`date +%-M`
a=`printf %${m}s`
b=`printf %$((60-m))s`
h=`date +%H`
echo $h ${a// /-}
printf "%02d %s" $((10#$h+1)) ${b// /-}
sleep 9
done
```
[Answer]
# [Raku](https://raku.org/) (aka Perl 6), 104 bytes
```
DateTime.now.&{"\ec{.hour.fmt: '%2s'} {'-'x.minute}\n{(.hour+1).fmt: '%2s'} {'-'x 60-.minute}"}.say xx*
```
Needs to be run on a [ANSI compatible terminal](https://graphcomp.com/info/specs/ansi_col.html) so that the control sequence for resetting the terminal works.
Pretty basic (because the more obfuscated approaches I tried turned out longer):
* `DateTime.now.&{" "}.say xx*`: Transform the current time into a string (see below) and say it, and repeat all of that an infinite number of times. The string is built like this:
* `\ec`: ANSI control code `<ESC>c` for resetting the terminal, which clears the screen.
* `{.hour.fmt: '%2s'}`: hour, right-aligned to 2 columns
* : space
* `{'-'x.minute}`: dash repeated times the minute
* `\n`: newline
* `{(.hour+1).fmt: '%2s'}`: next hour, right-aligned to 2 columns
* : space
* `{'-'x 60-.minute}`: dash repeated times 60 minus the minute
[Answer]
# [Prolog (SWI)](http://www.swi-prolog.org), 154 bytes
```
S+N:-get_time(A),format_time(atom(O),S,A),atom_number(O,N).
:-repeat,"%H"+H,"%M"+M,format("~t~d~2+ ~|~45t~*+
~|~t~d~2+ ~|~45t~*+
",[H,H,M,M]),\+sleep(60).
```
[Try it online!](https://tio.run/##KyjKz8lP1y0uz/z/P1jbz0o3PbUkviQzN1XDUVMnLb8oNxHKTSzJz9Xw19QJ1gFKgDjxeaW5SalFGv46fpp6XFa6RakFqYklOkqqHkraHkDKV0nbF2qChlJdSV1KnZG2Ql1NnYlpSZ2WNheQhSGmpBPtoeOh46vjG6upE6NdnJOaWqBhZqCp9/8/AA "Prolog (SWI) – Try It Online")
Welp, what a mess.
[Answer]
# [Gura](https://github.com/gura-lang/gura), 138 bytes
```
k(a,b)={if(a<10){a="0"+a;}println(a," ","-"*b)};repeat{t=datetime.now();k(t.hour,t.min);k(t.hour+1,60-t.min);os.sleep(60);print("\n"*30);}
```
Pretty short and straightforward :)
[Answer]
Ok, haven't done a code golf in a while, so here goes my sad attempt :)
# Unix Korn Shell: ~~177~~ ~~171~~ 170 bytes
```
while :
do
clear
h=`date +%H`
m=`date +%M`
d=-----
d=$d$d$d$d
d=$d$d$d
a=`echo $d|cut -b-$m`
let m=60-$m
b=`echo $d|cut -b-$m`
let i=h+1
echo "$h $a\n$i $b"
sleep 9
done
```
[Answer]
# Mathematica, 235 bytes
```
d=UpdateInterval;e=Dynamic;f=Refresh;g=AbsoluteTime;Grid[Partition[Riffle[e[f[Floor@Mod[g[]/3600+#,24],d->1]]&/@{0,1},With[{t=#},e[f[""<>Array["-"&,If[t==60,60-#,#]]&@Setting@Floor@Mod[g[]/60+#,60],d->1]]]&/@{0,60}],2],Alignment->Left]
```
[Answer]
# Processing, ~~204~~ ~~200~~ ~~198~~ 197 bytes
*5 bytes saved thanks to @L. Serné by using smarter ternaries*
```
void draw(){int i;String s=((i=hour())>9?i:" "+i)+" ";for(i=0;i<minute();i++)s+="-";s+="\n"+((i=hour()+1)>9?i>23?" 0":i:" "+i)+" ";for(i=0;i<60-minute();i++)s+="-";print(s);for(;i++<99;)println();}
```
This outputs 30+ newlines for each update (which takes place when the frame gets updated)
### Ungolfed
```
void draw(){
  int i;
  String s=((i=hour())>9?i:" "+i)+" ";
  for(i=0;i<minute();i++)
    s+="-";
  s+="\n"+((i=hour()+1)>9?i>23?" 0":i:" "+i)+" ";
  for(i=0;i<60-minute();i++)
    s+="-";print(s);
  for(;i++<99;)
    println();
}
```
[Answer]
# C, 239 bytes
```
#include<time.h>
#include<unistd.h>
#define F printf(
void d(n,p){for(;n--;F"%c",p));}int main(){time_t*t;for(;;){d(30,10);time(t);int*m=localtime(t);F"%2d ",m[2]);d(m[1],45);F"\n%2d ",(m[2]+1)%24);d(60-m[1],45);F"\n");sleep(1);}return 0;}
```
Inspired by Seth's and Abel's entries, this will output 0 instead of 24 for the next hour, as required, and will use 30 lines to clear the screen.
[Answer]
# SmileBASIC, 55 bytes
```
TMREAD OUT H,M,
CLS?H,"-"*M?(H+1)MOD 24,"-"*(60-M)EXEC.
```
Explanation:
```
TMREAD OUT HOUR,MINUTE,
CLS
PRINT HOUR,"-"*MINUTE
PRINT (HOUR+1) MOD 24,"-"*(60-MINUTE)
EXEC 0 'runs the code stored in slot 0 (the default)
```
Note: SmileBASIC only has 50 columns of text, so it won't look good...
]