0

I have tried This way and its not getting store,infact its giving me error,please sugguest if im making any mistake.

 error: use of undeclared identifier 'current_time_point'; did you mean
      'current_time_point_sec'?
    return time_point_sec(current_time_point());

This is my hpp file


#include <eosiolib/eosio.hpp>
#include <eosiolib/time.hpp>
#include <eosiolib/system.h>


private:
static inline time_point_sec current_time_point_sec()
  {
    return time_point_sec(current_time_point());
  }


  struct [[eosio::table]] deferred_f
  {
    uint64_t df_id;
    time_point_sec transaction_date;

    uint64_t primary_key() const
    {
      return df_id;
    }

};
typedef eosio::multi_index<"defer"_n, deferred_f> defer;
defer defer_table;


public:
[[eosio::action]]
void storedate();

This is Cpp file

void mainloan::storedate()
{
  defer_table.emplace(get_self(), [&](auto &df) {
    df.df_id = defer_table.available_primary_key();
    df.transaction_date = current_time_point_sec();
  });
}

2 Answers 2

2

eosiolib/* headers are deprecated and will be removed in eosio.cdt v1.7.x. Use eosio/* instead.

#include <eosio/system.hpp>

time_point_sec current_time_point_sec() {
   return time_point_sec(current_time_point());
}
0
0

This one is working for me,Replace current_time_point() --> now()

accept this change everything is OK in the code.

static inline time_point_sec current_time_point_sec()
  {
    return time_point_sec(now());
  }

1
  • how i can use now()???, i got the err "error: use of undeclared identifier 'now'; did you mean 'new'?"
    – KrisKoin
    Commented Nov 30, 2022 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.