Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Unix Timestamp with Yaws

Guest
Posted: Tue Jan 05, 2010 9:35 pm Reply with quote
Guest
I want Yaws to return plain text with the current unix timestamp.

Obviously my code does not work.

Thanks for the help!

- Hank

----------------------------------------------------------------


<erl>
get_unix_timestamp({MegaSecs, Secs, MicroSecs}=TS) ->
calendar:datetime_to_gregorian_seconds(
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())}.
</erl>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
Guest
Posted: Tue Jan 05, 2010 9:56 pm Reply with quote
Guest
On Wed, Jan 6, 2010 at 12:34 AM, Hank Knight <hknight555@gmail.com> wrote:
> I want Yaws to return plain text with the current unix timestamp.
>
> Obviously my code does not work.

Try to use the following out/1:

out(Time) ->
Guest
Posted: Tue Jan 05, 2010 10:00 pm Reply with quote
Guest
On Tue, Jan 5, 2010 at 4:34 PM, Hank Knight <hknight555@gmail.com (hknight555@gmail.com)> wrote:
Quote:
I want Yaws to return plain text with the current unix timestamp.

Obviously my code does not work.

Thanks for the help!

- Hank

----------------------------------------------------------------


<erl>

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum