Closed mrkagelui closed 1 year ago
Hi @mrkagelui, thanks for the question.
It's much more common to register a variable named now
(type timestamp
) and provide an updated value for the variable on each evaluation. From CEL's perspective, a function like now()
which fetches the latest timestamp would lead to subtle bugs related to differences in time between calls:
// Note, the duration calculation on the order of days needs to be modified as well
user.registered_at - now < duration(string(90*24) + "h")
Hopefully, that answers your question.
-Tristan
oh, sorry I'm a newbie here, let me try to spell this.
so in my use case, I'd need to somehow add the Now
in my user struct, and then
user.registered_at - user.now < duration(string(90*24) + "h")
?
I mean, I'm not sure how exactly to register a variable in every evaluation
Hi, apologies if this is a wrong channel to ask questions, and please redirect me.
I couldn't seem to figure out how to specify the current time in CEL. the use case is, for example, I want to know if a user was registered 90 days ago. I'd pass the entire user info into the program, and I'd like to specify something like
apparently that doesn't work. how should I do this?