Skip to content

Commit

Permalink
keep new_time public but deprecate, prevent hard break
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 16, 2024
1 parent e1187db commit 2081109
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion vlib/time/time.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ pub fn utc() Time {
return linux_utc()
}

// NOTE: turn into private function after deprecation period.
// new_time returns a time struct with the calculated Unix time.
fn new_time(t Time) Time {
@[deprecated: 'use `new()` instead']
@[deprecated_after: '2024-05-31']
pub fn new_time(t Time) Time {
if t.unix != 0 {
return t
}
Expand Down
5 changes: 4 additions & 1 deletion vlib/time/time.js.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ pub fn sleep(dur Duration) {
#while (new Date().getTime() < now + Number(toWait)) {}
}

// NOTE: turn into private function after deprecation period.
// new_time returns a time struct with the calculated Unix time.
fn new_time(t Time) Time {
@[deprecated: 'use `new()` instead']
@[deprecated_after: '2024-05-31']
pub fn new_time(t Time) Time {
if t.unix != 0 {
return t
}
Expand Down

0 comments on commit 2081109

Please sign in to comment.