Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7172207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:34:10+00:00 2026-05-28T15:34:10+00:00

I am interacting with a Remote Server. This Remote Server is in a different

  • 0

I am interacting with a Remote Server. This Remote Server is in a different Time Zone. Part of the Authentication requires me to produce the:

"The number of seconds since January 1, 1970 00:00:00 GMT
The server will only accept requests where the timestamp
is within 600s of the current time"

The documentation of erlang:now(). reveals that it can get me the the elapsed time since 00:00 GMT, January 1, 1970 (zero hour)
on the assumption that the underlying OS supports this
. It returns a size=3 tuple, {MegaSecs, Secs, MicroSecs}. I tried using element(2,erlang:now()) but the remote server sends me this message:

Timestamp expired: Given timestamp (1970-01-07T14:44:42Z)
not within 600s of server time (2012-01-26T09:51:26Z)

Which of these 3 parameters is the required number of seconds since Jan 1, 1970 ? What aren’t i doing right ? Is there something i have to do with the universal time as in calendar:universal_time() ?

UPDATE
As an update, i managed to switch off the time-expired problem by using this:

seconds_1970()->
    T1 = {{1970,1,1},{0,0,0}},
    T2 = calendar:universal_time(),
    {Days,{HH,Mins,Secs}} = calendar:time_difference(T1,T2),
    (Days * 24 * 60 * 60) + (HH * 60 * 60) + (Mins * 60) + Secs.

However, the question still remains. There must be a way, a fundamental Erlang way of getting this, probably a BIF, right ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:34:12+00:00Added an answer on May 28, 2026 at 3:34 pm

    You have to calculate the UNIX time (seconds since 1970) from the results of now(), like this:

    {MegaSecs, Secs, MicroSecs} = now().
    UnixTime = MegaSecs * 1000000 + Secs.
    

    Just using the second entry of the tuple will tell you the time in seconds since the last decimal trillionellium (in seconds since the UNIX epoch).

    [2017 Edit]
    now is deprecated, but erlang:timestamp() is not and returns the same format as now did.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am interacting with a web server using a desktop client program in C#
I have an interesting case of results sets returned by SQL Server being different
My client application uses a boost::asio::ip::tcp::socket to connect to a remote server. If the
I am trying to connect to a remote server through ssh. $ssh username@host command
I'm using SimpleXMLElement to read xml returned from a remote server. The results are
How do you set the Windows time zone on the local machine programmatically in
On my remote git server, I have a pre-receive hook that will check-in (commit)
I have a simple RMI 'compute' server application (similar to this ) that accepts
I'm trying to establish an interactive SSH connection to a remote server using PHP
Can you remove an item from a List<> whilst iterating through it? Will this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.