mirror of
https://codeberg.org/ultimateplayer1999/Golang-phish-update.git
synced 2024-11-24 23:08:21 -05:00
Added time to output with a time difference calculation. - Ultimateplayer1999
This commit is contained in:
parent
639ff3ceb7
commit
e3bb9ddccb
@ -14,3 +14,5 @@ The following code is needed in a .env. This is for the DB connection.
|
||||
> DB_PASS=
|
||||
|
||||
This is based on the phish table. Table can also be changed if needed.
|
||||
|
||||
Execution time is 1h24m16.934194673s. This was for 18811 records.
|
||||
|
10
dbupdate.go
10
dbupdate.go
@ -38,7 +38,7 @@ func main() {
|
||||
StartTime := time.Now()
|
||||
|
||||
// Format the start time
|
||||
formattedStartTime := StartTime.Format("10-01-2023 10:22:10")
|
||||
formattedStartTime := StartTime.Format("02-01-2006 15:04:05")
|
||||
|
||||
fmt.Println("Script started at " + formattedStartTime)
|
||||
// Perform a cleanup on DB
|
||||
@ -103,6 +103,10 @@ func main() {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
currentTime := time.Now()
|
||||
formattedTime := currentTime.Format("02-01-2006 15:04:05")
|
||||
fmt.Println(formattedTime + ": Initial database table setup done")
|
||||
|
||||
fmt.Println("Status code: ", resp.StatusCode)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
@ -138,14 +142,14 @@ func main() {
|
||||
EndTime := time.Now()
|
||||
|
||||
// Format the end time
|
||||
formattedEndTime := EndTime.Format("10-01-2023 10:22:50")
|
||||
formattedEndTime := EndTime.Format("02-01-2006 15:04:05")
|
||||
|
||||
fmt.Println("Recent changes recieved and has been added to the database. Removed domains deleted from database. Reorded domains.")
|
||||
|
||||
fmt.Println("Script ended at " + formattedEndTime)
|
||||
|
||||
// Calculate the time difference
|
||||
diff := formattedEndTime.sub(formattedStartTime)
|
||||
diff := EndTime.Sub(StartTime)
|
||||
|
||||
// Print the time difference
|
||||
fmt.Println("Time until completion: ", diff)
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user