Skip to main content
added 97 characters in body
Source Link

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();
  });
}

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

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();
  });
}

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();
  });
}

Source Link

how do i use current_time_point() to store date in eos table

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

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();
  });
}