g | x | w | all
Bytes Lang Time Link
031Raku Perl 6 rakudo240720T003625Zbb94
089Go 1.21+230808T194649Zbigyihsu
057Swift240301T182831ZmacOSist
nanAWK240302T220211Zcnamejj
1575Nibbles240303T035526ZMike Buf
059PARI/GP240302T105854Z138 Aspe
043YASEPL240226T183740Zmadeforl
015Itr230813T183348Zbsoelch
031ARBLE230816T053009ZATaco
043Desmos230816T051341Zfwoosh
095Python230813T172445Zuser1190
035Pure Bash230813T182644ZF. Hauri
010Thunno 2230718T101403ZThe Thon
061Scala200801T155656Zuser
018V vim210414T113420ZRazetime
082Rust200801T094754Zmadlaina
067Java JDK200520T100413ZOlivier
076C# .NET Core200703T144948ZEQ Code
047JavaScript V8200702T183334ZLebster
077C# .NET Core200701T152423ZBen Abbo
048PowerShell200630T051542ZVeskah
030x8616 machine code200527T202806Z640KB
014K ngn/k200617T125517Zmkst
052Julia200617T104744ZOhB00
016Google Sheets200522T142149ZEngineer
015Pyth200616T134847ZSok
087C# .NET Core200616T130609ZOhB00
028Golfscript200603T183657ZLCU00
042JavaScript ES6200519T164514ZArnauld
056Python 3.8 prerelease200521T221909ZEllis Wr
nan200521T003839ZSean Per
071Julia200521T150033ZMorrisMo
092C++ gcc200520T151044ZJubayer
050C gcc200520T120017ZNoodle9
01105AB1E200520T055419Zlyxal
041Ruby200520T210958ZArmand F
025Befunge93 FBBI200520T172747Zovs
042Python 2200519T165518Zdingledo
054Tcl200520T174125ZJason
033Bash + GNU utilities200520T031553ZMitchell
024Retina 0.8.2200519T172447Zmath jun
167Whitespace200520T160053ZKevin Cr
088Dart200520T151430ZElcan
046R200520T143159ZGiuseppe
057Python 3200519T155742Zbigyihsu
017CJam200520T140739Zlolad
013Husk200520T091625Zuser9206
052Io200520T091022Zuser9206
019Burlesque200520T085409ZMintable
020APL+WIN200520T064834ZGraham
014MathGolf200520T063809ZKevin Cr
016Perl 5 with plF/\d+\d+/ MListUtil+sum200520T062808ZDom Hast
010Jelly200519T230102ZJonathan
035Befunge93200519T213006ZAbigail
012Japt200519T163445ZShaggy
055Batch200519T195221ZNeil
013Charcoal200519T194311ZNeil
025perl MListUtil=min plF E200519T174705ZAbigail
2119J200519T173620ZJonah

Raku (Perl 6) (rakudo), 31 bytes

{/(.+)\:(.+)/;60*$0+$1 min 6e3}

Attempt This Online!

Go 1.21+, 93 92 89 bytes

import."fmt"
func f(t string)int{m,s:=0,0
Sscanf(t,"%d:%d",&m,&s)
return min(6e3,m*60+s)}

Attempt This Online!

Swift, 63 57 bytes

{min(Int(($0+"").prefix(2))!*60+Int($0.suffix(2))!,6000)}

Assign this closure to something and call it with the time in "##:##" format (or just call it directly).

Since a Swift String can't be indexed using an Int (blame Unicode support, though you'd be surprised just how rare String indexing is in well-written, real-life code), I had to use the prefix(_:) and suffix(_:) methods instead.

AWK, 30 bytes (27 bytes + 3 penalty for -F:)

$0=6000<(a=$1*60+$2)?6000:a

Try it online!

Pretty straightforward one... Relies on -F: to shorten the code needed to access mins/secs components of the input.

         a=$1*60+$2          - temp variable w/ simple calc of time
$0=6000<(          )?6000:a  - ternary to cap limit at 6000

Nibbles, 15 nibbles (7.5 bytes)

[6000+*60$;$

Attempt This Online!

Explanation

      *60$   # multiply first part of input by 60
     +    ;$ # add second part of input
[6000        # return lesser of sum and 6000

PARI/GP, 59 bytes

f(x)={s=strsplit(x,":");min(60*eval(s[1])+eval(s[2]),6000)}

Attempt This Online!

YASEPL, 43 bytes

=s=1'±colon!¥0,1*60=m¥1,1!+m}2,6000$6000`1<

explanation:

=s=1'±colon!¥0,1*60=m¥1,1!+m}2,6000$6000`1<           packed
=s                                                    set total time in seconds (S)
  =1'                                                 get user input and set it to var1
     ±colon                                           split it by ":"
           !¥0,1*60                                   set S to var1[0] (minutes) and multiply it by 60
                   =m¥1,1!+m                          set M to var1[1] (seconds) and add it to S
                            }2,6000$6000`1            if S > 6000, set it to 6000
                                          <           print S once done                                 

Itr, 15 bytes

ê©àé2+à©·+6000m

online interpreter

Explanation

ê©àé2+à©·+6000m ; implicit input
ê               ; split input into two parts '##:' and '##'
 ©              ; evaluate the second part to get the number of seconds
  à             ; swap
   é            ; split of the last character ':'
    2+          ; add 2 to ':' (ascii 58) giving 60
      à         ; swap
       ©        ; evaluate the number of minutes
        ·       ; multiply minutes by 60
         +      ; add seconds
          6000  ; literal 6000
              m ; minimum
                ; implicit output

ARBLE, 31 bytes

min(6e3,sub(s,1,2)*60+sub(s,4))

Try it online!

Desmos, 43 bytes

Takes input in the form of a ASCII code array. Use this to convert testcases to ASCII codes.

f(S)=min(total([600,60,0,10,1](S-48)),6000)

Try it on Desmos!

Python, 95 Bytes

lambda i: f"Lower"if(int(i[0:2])*60)+int(int(i[3:5]))>6000else(int(i[0:2])*60)+int(int(i[3:5]))

Example Input:

76:92 # String input

Example Output:

4652 # Number of seconds

Note: You do have to call the function and print it separately

Try it online!

Pure Bash, 35 bytes

echo $[s=${1/:/*60+},s>6000?6000:s]

Try it online!

Pure Bash, 36 bytes

echo $[(r=${1/:/*60+})>(b=6000)?b:r]

Try it online!

Thunno 2, 10 bytes

':/60ḋ«ç⁷Ọ

Try it online!

Explanation

':/60ḋ«ç⁷Ọ  '# Implicit input
':/         '# Split it on ":"
   60ḋ       # Convert from base 60
      «ç⁷    # Push 6000
         Ọ   # Dyadic minimum
             # Implicit output

Scala, 66 61 bytes

For those who like to live dangerously and assume things beyond a method's contract...

io.StdIn.readLine split ":"map(_.toInt)reduce(_*60+_)min 6000

reduce is not guaranteed to work from left to right, but it seems to do so by default.

Try it in Scastie

V (vim), 18 bytes

f:i*60<Esc>lr+0C<c-r>=<c-r>"
<Esc>

Try it online!

Rust, 82 bytes

|s:&str|6000.min(60*s[..2].parse::<u32>().unwrap()+s[3..].parse::<u32>().unwrap())

Try it online!

Unfortunately type inference for parse is very restricted and the turbofish must be used every time.

I also made some versions using fold instead of parse, but they are longer:

With a tuple accumulator and a closure to combine minutes and seconds:

|s:&[u8]|6000.min((|(a,b)|60*a+b)(s.iter().fold((0,0),|(a,b),x|match x{58=>(b,0),_=>(a,10*b+*x as i32-48)})))

Using a [i32;2] accumulator and .iter().sum()

|s:&[u8]|6000.min(s.iter().fold([0,0],|[a,b],x|match x{58=>[60*b,0],_=>[a,10*b+*x as i32-48]}).iter().sum())

And then there's this ungodly abomination using std::ops::Range<i32> as an accumulator, with -60*minutes as the start and seconds as the end. Eww.

|s:&[u8]|6000.min(s.iter().fold(0..0,|a,x|match x{58=>-60*a.end..0,_=>a.start..10*a.end+*x as i32-48}).len())

Java (JDK), 67 bytes

t->Math.min(6e3,new Long((t=t[0].split(":"))[0])*60+new Long(t[1]))

Try it online!

Credits

C# (.NET Core), 76 bytes

s=>Math.Min(s.Split(':').Select(int.Parse).Aggregate((e,i)=>(e*60+i)),6000);

Try it online

JavaScript (V8), 47 bytes

i=>Math.min(6e3,(i[0]+i[1]-0)*60+(i[3]+i[4]-0))

Call the function with the input string

C# (.NET Core) 77 bytes

s=>Math.Min(60*int.Parse(s.Substring(0,2))+int.Parse(s.Substring(3,2)),6000);

It assumes that the position of the colon is always 3

Try it online

PowerShell, 50 48 bytes

-2 bytes thanks to mazzy

$a,$b=$args-split':'
[Math]::min((60*$a+$b),6e3)

Try it online!

x86-16 machine code, 30 bytes

Binary:

00000000: 33d2 e806 00b2 3cf6 e292 acad 2d30 3086  3.....<.....-00.
00000010: c4d5 0a03 c2ba 7017 3bc2 7e01 92c3       ......p.;.~...

Listing:

33 D2           XOR  DX, DX         ; zero DX 
E8 0006         CALL CONV           ; get minutes into AX 
B2 3C           MOV  DL, 60         ; multiplier 60 sec/min  
F6 E2           MUL  DL             ; AX = AL * 60 
92              XCHG AX, DX         ; save seconds in DX 
AC              LODSB               ; skip ':' char 
            CONV:  
AD              LODSW               ; load next two ASCII chars into AX 
2D 3030         SUB  AX, '00'       ; ASCII convert 
86 C4           XCHG AL, AH         ; endian convert 
D5 0A           AAD                 ; BCD to byte convert
03 C2           ADD  AX, DX         ; add minutes to seconds
BA 1770         MOV  DX, 6000       ; set up max comparison
3B C2           CMP  AX, DX         ; is result > 6000?
7E 01           JLE  DONE           ; if not, return current value
92              XCHG AX, DX         ; otherwise 6000
            DONE:  
C3              RET                 ; return to caller

Input string in [SI], output number of seconds in AX.

Sample I/O using test program:

enter image description here

K (ngn/k), 14 bytes

Solution:

6000&60/.'":"\

Try it online!

Explanation:

6000&60/.'":"\ / the solution
          ":"\ / split string on ":"
        .'     / value (convert "12" => 12)
     60/       / from base-60
6000&          / min of result and 6000

Julia 54 53 52 bytes

f(x)=((i,j)=parse.(Int,split(x,":"));min(60i+j,6e3))

try it online

A single line solution for Julia.

A couple neat tricks here, we use f(x)=, a generic function declaration so we don't have to use the return end or function keywords.

We then use a compound expression like this (code;code;...).

Unfortunately, when using tuple destructuring i,j=, the tuple here must be wrapped in parenthesis for some reason, which adds two bytes.

Edits:

Google Sheets, 32 16 bytes

Saved 16 bytes thanks to Chronocidal straight up commenting a better answer.

=240*MIN(25,6*A1

Sheets will automatically add two trailing parentheses when you exit the cell. Input is in A1.


This could also be written as Min(6000,86400*TimeValue("0:"&A1)) if we wanted to fully expand it and be precise. As it is, we take advantage of the fact that Sheets will interpret a string that looks like a time to be in the format hh:mm by default and treat it as a number of days. For instance, =1*"12:00" would return 0.5 and =1*"6:00" would return 0.25. We can then divide by 60 to convert from hh:mm to mm:ss. If that's the only simplification we used, it would look like this:

=Min(6000,1440*A1

Dividing both 6000 and 1440 by 240 saves us 5 bytes inside the Min() function at a cost of only 4 bytes outside of it.

enter image description here

Pyth, 16 15 bytes

hS,6000ivcQ\:60

Try it online!

hS,6000ivcQ\:60   Implicit: Q=input()
         cQ\:     Split Q on ":"
        v         Convert each from string to integer
       i     60   Convert from base 60
  ,6000           Pair with 6000
 S                Sort
h                 Take the first element (i.e. smallest)
                  Implicit print

Edit: Previous version: hS,6000isMcQ\:60

C# (.NET Core) 88 87 bytes

s=>{var x=s.Split(':').Select(int.Parse).ToList();return Math.Min(60*x[0]+x[1],6000);};

Try it online

Removed trailing newline for 1 byte saving

Golfscript, 28 bytes

":"/~~\~60*+.6000.@<{\}{}if;

Try it online!

JavaScript (ES6), 42 bytes

s=>Math.min(6e3,+([m]=s.split`:`)[1]+m*60)

Try it online!

Commented

s =>               // s = input string
  Math.min(        // return the minimum of ...
    6e3,           //   ... 6000 and the following result ...
    +(             //   coerce to integer:
      [m] =        //     store into m the number of minutes
        s.split`:` //     which is the first term of the array obtained
                   //     by splitting s on ':'
    )[1] +         //   yield the seconds (2nd term of the above array)
    m * 60         //   and add the seconds multiplied by 60
  )                // end of Math.min()

Python 3.8 (pre-release), 56 bytes

lambda x:min(int((k:=x.split(":"))[1])+60*int(k[0]),6e3)

Try it online!

The types and the unwrap make this longer than it could be otherwise.

Rust, 121 bytes

use std::cmp::min;fn f(s:&str)->i32{let x:i32=s[..2].parse().unwrap();let y:i32=s[3..].parse().unwrap();min(x*60+y,6000)}

Try it online!

Explanation: 6000 had to be used because 6e3 is considered a float. 6e3 as i32 is longer than simply using 6000. In production code I would have written it 6_000 but saving the character is the game.

min is not imported by default. So we have to pay for that import.

parse does the work of other languages type casting. But since it could fail we also need the unwrap. String to int conversions are costly in golf for Rust. Using ? operator could in theory save us the unwrap but then the type for the return needs to be much longer: Result<i32, std::num::ParseError>. That also means the collect has to know about the Result too. We also have to wrap the final return in Ok(). So not much gain there.

I looked at using split but it ends up being longer due to working to get the tuple back out of the resulting iterator.

Julia, 71 bytes

 function f(x)
        m,s=parse.(Int,split(x,":"))
        return min(m*60+s,6e3)
 end

Try it online!

The part which was most interesting to me here, is the parse.() which parses each element in the array. Note the dot operator before the parentheses.

Could have knocked off one more byte by putting show() in the function instead of return. But, the footer or output box, on tio, wind up a bit of a mess due to the lack of new lines from show.

 function f(x)
        m,s=parse.(Int,split(x,":"))
        show(min(m*60+s,6e3))
 end

C++ (gcc), 92 bytes

#import<iostream>
main(){int m,s;char x;std::cin>>m>>x>>s;std::cout<<std::min(m*60+s,6000);}

Try it online!

Special Thanks to math junkie.

Special Thanks to ceilingcat for the educative suggestion.

C (gcc), 61 50 bytes

Saved a whopping 11 bytes thanks to dingledooper!!!

s;f(char*t){s=atoi(t)*60+atoi(t+3);s=s<6e3?s:6e3;}

Try it online!

05AB1E, 11 bytes

':¡60β6₄*)W

Try it online!

Coincidental port of most answers.

Explained

':¡60β6₄*)W

min(lhs: base10(number: split(string: input, character: ":"), from: 60), rhs: times(lhs: 6, rhs: 1000))

':  | Push the character ":"
¡   | Split the input upon ":"s -> [mins, seconds]
60β | Convert the list from base 60 to base 10
6₄* | Push the number `6000`
)W  | Wrap the converted input and 6000 into a list and find the smallest.

Ruby, 41 bytes

->i{[i[0,2].to_i*60+i[3,2].to_i,6e3].min}

Try it online!

16 bytes saved thanks to math-junkie

Befunge-93 (FBBI), 25 bytes

"<|`*"<d":+&*&
@.<
*"<d@.

Try it online!

Explanation:

The program consists of three parts (lines), the first one processes the input:

"<|`*"<d":+&*&    Stack                              IP direction

                  empty                              east
"<|`*"          push everything between the two quotes
                  42, 96, 124, 60                    east
      <         turn west
                  42, 96, 124, 60                    west
"<|`*"          push everything between the two quotes
                  60, 124, 96, 42, 42, 96, 124, 60   west
            *&  take an integer (minutes), convert to seconds
                  60*m, 124, ...                     west
          +&    take the next int, add to the total
                  60*m+s, 124, ...                   west
         :      duplicate TOS
                  60*m+s, 60*m+s, ...                west
    *"<d"       push 60*100 = 1000
                  6000, 60*m+s, 60*m+s, ...          west
   `            is greater than?
                  6000 > 60*m+s, 60*m+s, ...         west
  |             north-south if
                  60*m+s, ...                        north / south

If the total number of seconds is smaller or equal to 6000, the IP moves south and enters the second line:

@.<               Stack                              IP direction

                  60*m+s, ...                        south
  <             turn west
                  60*m+s, ...                        west
 .              print integer
                  124, ...                           west
@               Stop

If the number of second is greater than 6000, the IP moves north and enters the last line:

*"<d@.            Stack                              IP direction

                  60*m+s, ...                        north
  <             turn west
                  60*m+s, ...                        west
*"              push everything up to the next quote ...
 "<d@.          ... which is actually the same one.
                  60, 100, 64, ...                   west
*               Stop
                  6000, 64, ...                      west
     .          print 6000
                  64, ...                            west
    @           Stop

Python 2, 42 bytes

lambda t:min(int(t[:2])*60+int(t[3:]),6e3)

Try it online!

Tcl, 54 bytes

proc f {a} {scan $a %d:%d a b
expr min(60*$a+$b,6000)}

Try it online!

Explanation

Sadly, the times with leading zeroes mess up string interpolation directly into expr (using ternaries) because Tcl thinks they are octal, so I had to settle for using scan to force interpretation as decimal. Also, if 6000.0 is allowed as output, I can save 1 byte.

Bash + GNU utilities, 33 bytes

dc<<<[6000]sL${1/:/ 60*}+dlLx\<Lp

Try it online!

Or try the test suite.

The input string is passed as an argument, and the output is on stdout.


How it works

First bash expands ${1/:/ 60*} by taking argument 1 and replacing the : with 60* (there's a space before the 60 that StackExchange isn't displaying here). For example, if the input is 01:30, the expansion is 01 60*30.

Also, \< gets used as the character < without its special meaning in the shell.

So what happens is that dc is run with

[6000]sLminutes60*seconds+dlLx<Lp

as its program (where "minutes" and "seconds" refer to the actual two-digit numbers).

This carries out the following operations:

[6000]               Definition of a macro which pushes 6000 on the stack.
sL                   Save the macro in register L.
minutes 60*seconds+  Compute minutes*60+seconds,
                        which is the total number of seconds.
d                    Duplicate the total number of seconds on the stack.
lLx                  Run macro L, which pushes 6000 on the stack.
                     The stack now looks like:
                        #seconds #seconds 6000
                        (top of stack on the right).
<L                   Pop 6000 and #seconds from the stack;
                        if 6000 < #seconds,
                          then run macro L to push 6000 on the stack again.
                     At this point, the item at the top of the stack is:
                        #seconds, if #seconds <= 6000,
                        6000, if #seconds > 6000.
p                    Print the top of the stack.

Retina 0.8.2, 27 24 bytes

\d+
$*
+`1:
:60$*
6000`1

Try it online!

Explanation

I'll use the input 01:30 as an example.

\d+
$*

Convert minutes and seconds to unary. For example, 01:30 would become 1:111111111111111111111111111111.

+`1:
:60$*

Loop over each digit preceding the :, move it to the right of the :, and repeat the digit 60 times. The 01:30 example would now be :1111111111111111111... (90 ones)

6000`1

Count the first 6000 ones.

Whitespace, 167 bytes

[S S S T    S T T   T   S T T   T   S S S S N
_Push_6000][S N
S _Duplicate_6000][S N
S _Duplicate_6000][S N
S _Duplicate_6000][T    N
T   S _Read_STDIN_as_char][T    T   T   _Retrieve][S S S T  T   S S S S N
_Push_48][T S S T   _Subtract][S S S T  S S T   S T T   S S S N
_Push_600][T    S S N
_Multiply][S N
S _Duplicate][S N
S _Duplicate][T N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve][S S S T  T   S S S S N
_Push_48][T S S T   _Subtract][S S S T  T   T   T   S S N
_Push_60][T S S N
_Multiply][T    S S S _Add][S N
S _Duplicate][T N
T   S _Read_STDIN_as_character][S N
S _Duplicate][S N
S _Duplicate][T N
T   T   _Read_STDIN_as_integer][T   T   T   _Retrieve][T    S S S _Add][S N
T   _Swap_top_two][T    S S T   _Subtract][S N
S _Duplicate][N
T   T   N
_If_negative_jump_to_Label_PRINT][S N
S _Duplicate][T S S T   _Subtract][N
S S N
_Create_Label_PRINT][T  S S S _Add][T   N
S T _Print_as_integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Unfortunately Whitespace is unable to read an integer when there is anything other than a newline (or nothing) behind it. Because of this, the minute-digits has to be read loose as characters, and seconds can be read as an integer..

Integer m1 = Read STDIN as character
m1 = m1 - 48
m1 = m1 * 600
Integer m2 = Read STDIN as character
m2 = m2 - 48
m2 = m2 * 60
Integer m = m1 + m2
Read STDIN as character (the ':', which we simply ignore)
Integer s = Read STDIN as integer
Integer total_seconds = m + s
If(total_seconds - 6000 < 0):
  Print total_seconds as integer to STDOUT
Else:
  Print 6000 as integer to STDOUT

Dart, 88 bytes

import'dart:math';f(s)=>s.split(":").map(int.parse).reduce((v,e)=>min<num>(v*60+e,6e3));

Try it online!

R, 46 bytes

`:`=c;min(6e3,eval(parse(t=scan(,"")))%*%60:1)

Try it online!

Just redefine : so that we can just use eval to concatenate the hours and minutes together, and do a dot product with c(60,1) to get the seconds.

Python 3, 82 72 62 61 57 bytes

def f(s):x,y=map(int,s.split(":"));return min(x*60+y,6e3)

Try it online!

CJam, 17 bytes

q':/:i~\60*+6e3e<

Try it online!

q':/:i~\60*+6e3e<  e# Whole program
q                  e# Read input          [e.g "99:98"]
 ':/               e# Split on :          [e.g ["99" "98"]]
    :i             e# Convert to integers [e.g [99 98]]
      ~\           e# Dump and swap       [e.g 98 99]
        60*        e# Multiply by 60      [e.g 98 5940]
           +       e# Add                 [e.g 6038]
            6e3e<  e# Get minimum to 6000 [e.g 6000]
                   e# Implicit output

Husk, 13 bytes

y6000B60mrx":

Try it online!

Explanation

          x":    Split on colons
        mr       Convert from string form
     B60         Interpret in base 60
y6000            Minimum with 6000

Io, 52 bytes

Port of the Python answer.

method(x,doString(x split(":")join("*60+"))min(6e3))

Try it online!

Burlesque, 19 bytes

ps1RAp^60.*.+6000<.

Try it online!

Explanation:

ps                  # Parses input string as block: mm:ss => { mm ":" ss }
  1RA               # Removes element at index 1 from block: { mm ss }
     p^             # Splits block to stack
       60.*         # Multiply top element by 60
           .+       # Sum both elements
             6000<. # Return the minimum of the calculated value or 6000

APL+WIN, 20 bytes

Prompts for time as string:

6E3⌊60⊥(⍎2↑n),⍎3↓n←⎕

Try it online! Courtesy of Dyalog Classic

MathGolf, 14 bytes

2<i╟*l2>i+6♪*╓

Try it online.

Explanation:

                #  i.e. input = "99:80"
2<              # Take the first two characters of the (implicit) input-string
                #  STACK: ["99"]
  i             # Convert it from string to integer
                #  STACK: [99]
   ╟*           # Multiply it by 60
                #  STACK: [5940]
     l          # Push the input-string again
                #  STACK: [5940,"99:80"]
      2>i       # Leave its last two characters, and also cast it to an integer
                #  STACK: [5940,80]
         +      # Add them together
                #  STACK: [6020]
          6♪*   # Push 6*1000: 6000
                #  STACK: [6020,6000]
             ╓  # Only leave the smallest value of the top two values on the stack
                #  STACK: [6000]
                # (after which the entire stack joined together is output implicitly)

Perl 5 with -plF/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((\d+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))):(\d+)/ -MList::Util+sum,min, 16 bytes

Not competing with @Abigail's answer which is not 'cheaty' like this one.

$_=min 6e3,sum@F

Try it online!

Explanation

Using the -F flag, the left part of the input is replicated 60 times and the right part is extracted once, into @F. These are summed to yield the number of seconds and we use min to ensure it's not over 6000.

Jelly, 10 bytes

ṣ”:Vḅ60«6ȷ

A monadic Link accepting a list of characters which yields an integer.

Try it online!

How?

ṣ”:Vḅ60«6ȷ - Link: list of characters, T
 ”:        - character ':'
ṣ          - split T at ':'
   V       - evaluate as Jelly code -> [m,s]
     60    - sixty
    ḅ      - convert from base -> 60*m+s
        6ȷ - 6*10^3 = 6000
       «   - minimum

Befunge-93, 35 bytes

&~$"<"*&+:v
v!`*"<""d"<
_"d""<"*.@.

Try it online!

Reads a number, read a character (:) and discard it, multiply the read number with 60 (ASCII character 60 equals "<"), read the second number, and add it to the product (this gives the number of seconds). Dub the number of seconds; push 6000 (6000 = 60 * 100 = "<" * "d") on the stack and compare. If 6000 is less than the number of seconds, push another 6000 on the stack and print it. Else, print the number of seconds (which is now the top of the stack).

Japt, 12 bytes

Feel like I'm missing a trick here ...

q': ì60 m6e3

Try it

q': ì60 m6e3     :Implicit input of string
q':              :Split on ":"
    ì60          :Convert to integer from base-60 digit array
        m6e3     :Minimum with 6000

Batch, 55 bytes

@set/ps=
@cmd/cset/a"(s=%s::=*60+%)+(s-=6000)*(-s>>13)

Takes input on STDIN. Explanation: %s::=*60+% substitutes *60+ for the : in the input, resulting in an arithmetic expression that converts the time into seconds. Since Batch has no minimum function, I then have to compute this via right-shifting the the difference which results in 0 or -1 which is then used to adjust the seconds, which are then automatically output thanks to the use of cmd/c.

Charcoal, 13 bytes

I⌊⟦↨I⪪S:⁶⁰×⁶φ

Try it online! Link is to verbose version of code. Explanation:

      S         Input string
     ⪪ :        Split on literal `:`
    I           Cast each part to integer
   ↨    ⁶⁰      Convert from base 60
           ⁶    Literal 6
          ×     Multiplied by
            φ   Predefined variable 1000
 ⌊⟦             Take the minimum
I               Cast to string
                Implicitly print

perl -MList::Util=min -plF: -E, 25 bytes

$_=min 60*$F[0]+$F[1],6E3

Try it online!

J, 21 19 bytes

6e3<.60#.[:".' '2}]

Try it online!