Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp is incorrect when a user joins the queue #110

Open
alexanderl19 opened this issue May 12, 2020 · 0 comments
Open

Timestamp is incorrect when a user joins the queue #110

alexanderl19 opened this issue May 12, 2020 · 0 comments

Comments

@alexanderl19
Copy link

Expected Behavior

The server returns the current UNIX time in ms.

Current Behavior

The server returns a time that is seemingly random.

Possible Solution

Change System.nanoTime() to System.currentTimeMillis()

https://github.com/UB-CSE/OfficeHours/blob/develop/src/main/scala/model/OfficeHoursServer.scala#L63

class EnterQueueListener(server: OfficeHoursServer) extends DataListener[String] {
  override def onData(socket: SocketIOClient, username: String, ackRequest: AckRequest): Unit = {
>>>>server.database.addStudentToQueue(StudentInQueue(username, System.nanoTime()))<<<<
    server.socketToUsername += (socket -> username)
    server.usernameToSocket += (username -> socket)
    server.server.getBroadcastOperations.sendEvent("queue", server.queueJSON())
  }
}

Steps to Reproduce

  1. Click the join queue button a few times
  2. Look at the time stamps in the waiting list
  3. Convert time stamps from UNIX to human time

Context (Environment)

It is important to see when people have queued.
This information could help give an estimate of how long someone would have to wait before they queue or it could indicated that the TA's can not keep up with the demand.

Detailed Description

According to https://docs.oracle.com/javase/8/docs/api/java/lang/System.html, System.nanoTime() returns the Returns the current value of the running Java Virtual Machine's high-resolution time source, in nanoseconds., not the current UNIX time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant