How to generate epoch time at run-time

Hi All,

I have generated the following script using Gatling recorder. You can see time stamp as time criteria at various places. How to generate these timestamp at runtime instead of hard coded values?

val scn = scenario(“LocalhostSimulation1”)
.exec(http(“login”)
.post("/auth/token")
.headers(headers)
.formParam(“grant_type”, “password”)
.formParam(“username”, “")
.formParam(“password”, "
*”))
.pause(1)
.exec(http(“Choose criteria”)
.options("/api/account/settings?=1486533171837")
.headers(headers)
.resources(http(“Clietn side settings”)
.options("/api/system/clientsidesettings?
=1486533171838")
.headers(headers),
http(“Main page”)
.get(“http://” + uri1 + “:3000/app/main/main.html”)
.headers(headers),
http(“Navigation bar”)
.get(“http://” + uri1 + “:3000/app/core/layout/navbar/navbar.html”)
.headers(headers),
http(“Side bar”)
.get(“http://” + uri1 + “:3000/app/core/layout/sidebar/sidebar.html”)
.headers(headers),
http(“Wizard”)
.get(“http://” + uri1 + “:3000/app/core/layout/wizard/wizard.html”)
.headers(headers),
http(“User settings”)
.get(“http://” + uri1 + “:3000/app/core/layout/settings/usersettings.html”)
.headers(headers),
http(“Client side settings 2”)
.get("/api/system/clientsidesettings?=1486533171838")
.headers(headers),
http(“Validate”)
.get(“http://” + uri1 + “:3000/app/main/validate/validate.html”)
.headers(headers),
http(“Employment potential”)
.get(“http://” + uri1 + “:3000/app/main/validate/EmploymentPotential/employmentPotential.html”)
.headers(headers),
http(“Get font”)
.get(uri2 + “”)
.headers(headers),
http(“Education level”)
.options("/api/lookup/get/educationlevel?
=1486533143911")
.headers(headers)))
.pause(13)

import io.gatling.core.Predef._
import io.gatling.http.Predef._

import scala.concurrent.duration._

class UnixTime extends Simulation {

  val unixTime = scenario("Unix Time")
    .exec(_.set("unixTime", System.currentTimeMillis / 1000))
    .exec { session => println(session("unixTime").as[String]); session }

  setUp(unixTime.inject(
    rampUsers(5) over(5 seconds)))
}

Aidy