I would like to make a countdown timer, but cannot find a reliable method to make the DateList[] function reverse.
The not so robust code for the Digital Clock with the display of seconds follows:
digit[i_, xoffset_] := Module[{params},
params = Part[segmentParams, segmentPieces[[i + 1]]];
params = Map[# + {0, xoffset, 0, 0} &, params];
Graphics[makeSegment /@ params]];
makeSegment[params_] :=
Translate[
Rotate[Polygon[{{0, 0}, {params[[4]], 0}, {params[[4]] + 1/4,
1/4}, {params[[4]], 1/2}, {0, 1/2}, {-1/4, 1/4}}],
params[[1]] Degree], {params[[2]], params[[3]]}]
segmentParams = {{0, 0, 1.2, 1}, {90,-.6, .6, .6}, {90,1,.6,.6}, {0, 0, 0, 1},
{90,-.6,-.6,.6}, {90, 1,-.6,.6}, {0, 0,-1.2, 1}};
segmentPieces = {{1, 2, 3, 5, 6, 7}, {3, 6}, {1, 3, 4, 5, 7}, {1, 3, 4, 6, 7},
{2, 3, 4, 6}, {1, 2, 4, 6, 7}, {1, 2, 4, 5, 6, 7}, {1, 3, 6},
{1, 2, 3, 4, 5, 6, 7}, {1, 2, 3, 4, 6, 7}};
timer = Dynamic@Refresh[Show[{digit[Floor[DateList[][[6]]/10], 12],
digit[Mod[Floor@DateList[][[6]], 10], 15]}, ImageSize -> 26], UpdateInterval -> 1]
I say not so robust because after it's running, it has a tendency to stop. Not sure why yet, but none the less I would like to make it run backwards. I can use: RunScheduledTask to begin the timer and set an alarm but would like to show the time counting down.