Convert seconds to days, hours, minutes

So, I am trying the above timeticks conversion and am getting nowhere… I have my sensor configs in a sensors directory with files per device under that. This works and has worked for ages. But, when I put the below code in my mikrotik sensors file and run a configuration check it just sits and spins until I cut the code out and check it again… What have I done wrong? I have included the snmp sensor that sources the data and works fine.

  - platform: snmp
    name: "MT610 uptime"
    unique_id: mt610uptime
    host: 192.168.1.9
    community: homeread
    baseoid: .1.3.6.1.2.1.1.3.0
    accept_errors: true

  - platform: template
    sensors:
      mt610_real_uptime:
      friendly_name: Mt610 Real Uptime
      value_template: >-
        {% set time = states.sensor.mt610_uptime.state | int %}
        {% set minutes = ((time % 360000) / 6000) | int%}
        {% set hours = ((time % 8640000) / 360000) | int %}
        {% set days = (time / 8640000) | int %}

        {%- if time < 6000 -%}
          Less than a minute
        {%- else -%}
          {%- if days > 0 -%}
            {%- if days == 1 -%}
              1 day
            {%- else -%}
              {{ days }} days
            {%- endif -%}
          {%- endif -%}
          {%- if hours > 0 -%}
            {%- if days > 0 -%}
              {{ ', ' }}
            {%- endif -%}
            {%- if hours == 1 -%}
              1 hour
            {%- else -%}
              {{ hours }} hours
            {%- endif -%}
          {%- endif -%}
          {%- if minutes > 0 -%}
            {%- if days > 0 or hours > 0 -%}
              {{ ', ' }}
            {%- endif -%}
            {%- if minutes == 1 -%}
              1 minute
            {%- else -%}
              {{ minutes }} minutes
            {%- endif -%}
          {%- endif -%}
        {%- endif -%}