简体   繁体   中英

Need Help: Firebase.ServerValue.TIMESTAMP #firebase

on my local Client Device i have a wrong time. When i update the Database with Firebase.ServerValue.TIMESTAMP it uses my wrong client time. I thought Firebase.ServerValue.TIMESTAMP uses the server side firebase time. Is that right?

My Query:

  ref.child("users").child(authData.uid).child('profile').update(
    {
      userid: authData.uid,
      username: authData.auth.username,
      lastlogin: Firebase.ServerValue.TIMESTAMP
    },
    function(error){
     if(error===null){
       //…
     }
     else
     {
       //…
     }
    }
  );

Thanks für your help!!!

Steffen

Okay, i found my bug.

I thought .info/serverTimeOffset is the current latency and i calculated the difference wrong. Everything works correct. Firebase.ServerValue.TIMESTAMP sets a Server Timestamp as expected. The .info/serverTimeOffset ist the difference to the local client time and not the latency. I don´t remember where i read this wrong info.

Thanks for your help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM