Solved Getting the timestamp (C#)

Discussion in 'Rust Development' started by xFakE, Sep 8, 2015.

  1. Hello guys,

    there's a litte problem I want to fix.
    I'm still working on an unstuck plugin and implement a cooldown.
    Nothing complicated a really simple way to prevent abuse.

    What I need from you?

    The plugin is writtin in C++ and based on PaiNs unstuck tool.

    I only want to get a timestamp and save it as integer not in string. Not more...
    Tried so much ways but it wont work.

    Could anyone help me?
     
  2. var time = DateTime.UtcNow.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
     
  3. Wulf

    Wulf Community Admin

    Assuming you mean C#, not C++?
     
  4. Sorry, this was my fault.
    Of cause i meant C#.

    THANK YOU for you fast reply!
     
    Last edited by a moderator: Sep 8, 2015
  5. Easier still:

    long x= DateTime.Now.ToBinary();
    DateTime d= DateTime.FromBinary(x);