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

use unix() method to access unix time values #265

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/branch.v
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn (mut app App) fetch_branch(repo Repo, branch_name string) ! {
}

app.create_branch_or_update(repo.id, branch_name, user.username, last_commit_hash,
int(committed_at.unix))!
int(committed_at.unix()))!
}

fn (mut app App) create_branch_or_update(repository_id int, branch_name string, author string, hash string, date int) ! {
Expand Down
2 changes: 1 addition & 1 deletion src/comment.v
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn (mut app App) add_issue_comment(author_id int, issue_id int, text string) ! {
comment := Comment{
author_id: author_id
issue_id: issue_id
created_at: int(time.now().unix)
created_at: int(time.now().unix())
text: text
}

Expand Down
2 changes: 1 addition & 1 deletion src/gitly.v
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn new_app() !&App {

mut app := &App{
db: sqlite.connect('gitly.sqlite') or { panic(err) }
started_at: time.now().unix
started_at: time.now().unix()
}

set_rand_crypto_safe_seed()
Expand Down
2 changes: 1 addition & 1 deletion src/issue.v
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn (mut app App) add_issue(repo_id int, author_id int, title string, text string
text: text
repo_id: repo_id
author_id: author_id
created_at: int(time.now().unix)
created_at: int(time.now().unix())
}

sql app.db {
Expand Down
4 changes: 2 additions & 2 deletions src/repo.v
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ fn (mut app App) update_repo_branch_from_fs(mut repo Repo, branch_name string) !
}

app.add_commit_if_not_exist(repo_id, branch.id, commit_hash, commit_author,
commit_author_id, commit_message, int(commit_date.unix))!
commit_author_id, commit_message, int(commit_date.unix()))!
}
}
}
Expand Down Expand Up @@ -396,7 +396,7 @@ fn (mut app App) update_repo_branch_data(mut repo Repo, branch_name string) ! {
}

app.add_commit_if_not_exist(repo_id, branch.id, commit_hash, commit_author,
commit_author_id, commit_message, int(commit_date.unix))!
commit_author_id, commit_message, int(commit_date.unix()))!
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tag.v
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn (mut app App) fetch_tags(repo Repo) ! {
}

app.insert_tag_into_db(repo.id, tag_name, commit_hash, commit_message, user.id,
int(commit_date.unix))!
int(commit_date.unix()))!
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/user.v
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ pub fn (mut app App) increment_user_post(mut user User) ! {

u := *user
id := u.id
now := int(time.now().unix)
lastplus := int(time.unix(u.last_post_time).add_days(1).unix)
now := int(time.now().unix())
lastplus := int(time.unix(u.last_post_time).add_days(1).unix())

if now >= lastplus {
user.last_post_time = now
Expand Down Expand Up @@ -376,7 +376,7 @@ fn (mut app App) change_full_name(user_id int, full_name string) ! {
}

fn (mut app App) incement_namechanges(user_id int) ! {
now := int(time.now().unix)
now := int(time.now().unix())

sql app.db {
update User set namechanges_count = namechanges_count + 1, last_namechange_time = now
Expand Down
2 changes: 1 addition & 1 deletion src/user_routes.v
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub fn (mut app App) handle_update_user_settings(username string) vweb.Result {
}

is_first_namechange := app.user.last_namechange_time == 0
can_change_usernane := app.user.last_namechange_time + namechange_period <= time.now().unix
can_change_usernane := app.user.last_namechange_time + namechange_period <= time.now().unix()

if !(is_first_namechange || can_change_usernane) {
app.error('You need to wait until you can change the name again')
Expand Down
2 changes: 1 addition & 1 deletion src/utils.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import math
import os

pub fn (mut app App) running_since() string {
duration := time.now().unix - app.started_at
duration := time.now().unix() - app.started_at

seconds_in_hour := 60 * 60

Expand Down
Loading