[General Questions and Answers] skippa_c:
I looked for android intents but couldn't figure it out. Even if you could get an intent to work, I don't think you can have the return value set a value for a Llama variable, it's one-way? Otherwise I'd write a background service to just translate a formatted string with SimpleDateFormat.

I use the following solution that uses Llama only, no outside apps or intents I put all the tasks into a 'time' category.

There are four variables used, one for each numeric position in a time string:

hr: hour

m1: first position of the minute count

m2: second position of the minute count

pd: period (am/pm)

Think of it as a manual digital clock. Each variable is initialized at 1:00 AM and repeats according to the appropriate frequency:

Tasks to initialize variables:

begin_hr: Between 1:00 AM and 1:01 PM - set Llama variable 'hr' to '0' every 12 hours

begin_m1: Between 1:00 AM and 12:01 AM - set Llama variable 'm1' to '-1' every 1 hour

begin_m2: Between 1:00 AM and 12:51 AM - set Llama variable 'm2' to '-1' every 10 minutes

begin_pd_am: Between 12:00 AM and 11:59 AM - set Llama variable 'pd' to 'a.m.'

begin_pd_pm: Between 12:00 AM and 11:59 AM - set Llama variable 'pd' to 'p.m.'

Tasks to increment variables:

incr_hr: Between 1:00 AM and 12:01 AM - increment Llama variable 'hr' every 1 hour

incr_m1: Between 1:00 AM and 12:51 AM - increment Llama variable 'm1' every 10 minutes

incr_m2: Between 1:00 AM and 12:59 AM - increment Llama variable 'm2' every 1 minute

At 1:00 AM, all the begin tasks run, so the variable string equals:

##hr##:##m1####m2## ##pd## = 0:-1-1 a.m.

The incr tasks are alphabetically after the begin tasks, so they run afterwards, also at 1:00 AM, so then the string equals:

##hr##:##m1####m2## ##pd## = 1:00 a.m.

Then after 1 minute, incr_m2 will repeat, making:

##hr##:##m1####m2## ##pd## = 1:01 a.m.

I usually wake up at 6:40 a.m. and I want my phone to tell me the time every 5 minutes after my alarm goes off until I leave my house so I can know if I need to pick up the pace to make it to work on time. My next tasks to do this were:

alarmed: When the next alarm is due - set Llama variable 'alarmed' to 'true'

alarmed_off: When not at Home - set Llama variable 'alarmed' to 'false'

time_check: When 'alarmed' has a value of 'true' - queue an event named 'time_say' every 5 minutes ->

time_say: When 'alarmed' has a value of 'true' and [when 'm2' has a value of '0' or when 'm2' has a value of '5'] - say '##hr##:##m1####m2## ##pd##'

alarmed 'When the next alarm is due' will only fire once, at the moment the alarm goes off, so it needs to trigger another event that will repeat, since it can't repeat because the condition will be false. I only wanted the phone to tell me the time every 5 minutes when the second place of the minutes was 0 or 5, so it wouldn't say '6:51' or '7:03'. It would sometimes start at 6:40, then repeat at 6:46, and then be off by a minute for whatever reason, maybe because of the time it took to perform the actual 'say'. That's why time_check does a queue instead of the say.

Also, I tried using the newest Google TTS high quality voices, but often the event would take minutes long because apparently it was trying to connect to a Google server to parse the text/generate the audio, so it would say '7:05 a.m.' at like 7:12. This is a problem with TTS, not Llama's 'say' action. I changed the TTS to the lower quality and it has helped.

This is such a hack... I wish Llama had some built-in variables that could translate to the SimpleDateFormat current date/time, so I could get ##h##:##mm## ##a##

Not to mention this really fills up the task history with incr_m2 running every minute.

But Llama is free, so no complaining :D