On Tue, Jan 5, 2010 at 4:34 PM, Hank Knight <hknight555@gmail.com> wrote:
I want Yaws to return plain text with the current unix timestamp.

Obviously my code does not work.

Thanks for the help!

- Hank


 get_unix_timestamp({MegaSecs, Secs, MicroSecs}=TS) ->
calendar:now_to_universal_time(TS) ) -
   calendar:datetime_to_gregorian_seconds( {{1970,1,1},{0,0,0}} ).

 out(Time) ->
       {content, "text/plain",   "Timestamp: ", libs:get_unix_timestamp(now())}.

Close -- change your return value of out/1 to this:

{content, "text/plain",   ["Timestamp: ", integer_to_list(libs:get_unix_timestamp(now()))]}

(I assume the get_unix_timestamp call really does live in a libs module, not within your .yaws file as you show above.)