Arbitrary Clock Time Calculator Create a routine to calculate the position of each unit of a clock with an arbitrary number of units (minutes, hours, half-days, days, years, parsecs, quarter-quells, etc), where each unit can be equally sub-divided into an arbitrary number of sub-units; after n base units have elapsed. 

Basically, figure out what a clock would show after n seconds given user defined lengths for minutes, hours, days, etc.

For example, after 86,400 seconds on a clock that has 60 seconds in a minute, 60 minutes in an hour, 12 hours per half day, 2 half days per day, and 365 days in a year; you get the following:

clockFunction(86400,[60,60,12,2,365]) = 0,0,0,0,1

(Standard Clock)

clockFunction(86400,[60,60,12,2]) = 0,0,0,0

(Standard Clock - Rolling Over)

clockFunction(7430201,[100,100,10,10,3,12]) = 1,2,3,4,1,2

(French Republican Calendar [sec / min, min / hr, hrs / day, days / wk, wks / mo, mo / yr])

clockFunction(2443332,[60,60,24,365]) = 12,42,6,28

(Standard Clock - Donnie Darko)

clockFunction(63570500940,[60,60,12,2,365,10000]) = 0, 29, 4, 1, 294, 2015

(Standard Clock - Back to the Future)

Shortest code that works wins!

Clarifications:


All Units are integer
All Units are greater than 0
Dyalog APL, 9 7 5 bytes

⌽⊤⍨∘⌽


This is a dyadic function train that expects seconds and lengths as left and right arguments. It is equivalent to the following, train-less function:

{⌽⍺⊤⍨⌽⍵}


Verify all test cases at once on TryAPL.

How it works

    ⌽ Reverse the right argument...
   ∘    and...
 ⊤⍨     perform mixed base encoding on the left argument with those bases.
⌽     Reverse the order of the result.