mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-13 14:48:54 +02:00
ef4c5eb65e
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
15 lines
545 B
Scala
15 lines
545 B
Scala
package com.twitter.follow_recommendations.common.utils
|
|
|
|
import com.twitter.product_mixer.core.model.marshalling.request.HasClientContext
|
|
import com.twitter.snowflake.id.SnowflakeId
|
|
import com.twitter.util.Duration
|
|
import com.twitter.util.Time
|
|
|
|
object UserSignupUtil {
|
|
def signupTime(hasClientContext: HasClientContext): Option[Time] =
|
|
hasClientContext.clientContext.userId.flatMap(SnowflakeId.timeFromIdOpt)
|
|
|
|
def userSignupAge(hasClientContext: HasClientContext): Option[Duration] =
|
|
signupTime(hasClientContext).map(Time.now - _)
|
|
}
|