Skip to content

Commit

Permalink
(time.Time).UnixMilli was added in go1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
yitsushi committed Oct 8, 2021
1 parent 1a4103f commit 4f4329d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions core/application/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestApp_CreateMicroVM(t *testing.T) {
)

expectedCreatedSpec := createTestSpec("id1234", defaults.MicroVMNamespace)
expectedCreatedSpec.Spec.CreatedAt = frozenTime().UnixMilli()
expectedCreatedSpec.Spec.CreatedAt = frozenTime().Unix()

rm.Save(
gomock.AssignableToTypeOf(context.Background()),
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestApp_CreateMicroVM(t *testing.T) {
)

expectedCreatedSpec := createTestSpec("id1234", "default")
expectedCreatedSpec.Spec.CreatedAt = frozenTime().UnixMilli()
expectedCreatedSpec.Spec.CreatedAt = frozenTime().Unix()

rm.Save(
gomock.AssignableToTypeOf(context.Background()),
Expand Down Expand Up @@ -198,7 +198,7 @@ func TestApp_UpdateMicroVM(t *testing.T) {
)

expectedUpdatedSpec := createTestSpec("id1234", "default")
expectedUpdatedSpec.Spec.UpdatedAt = frozenTime().UnixMilli()
expectedUpdatedSpec.Spec.UpdatedAt = frozenTime().Unix()

rm.Save(
gomock.AssignableToTypeOf(context.Background()),
Expand Down Expand Up @@ -294,7 +294,7 @@ func TestApp_DeleteMicroVM(t *testing.T) {
)

expectedUpdatedSpec := createTestSpec("id1234", "default")
expectedUpdatedSpec.Spec.DeletedAt = frozenTime().UnixMilli()
expectedUpdatedSpec.Spec.DeletedAt = frozenTime().Unix()

rm.Save(
gomock.AssignableToTypeOf(context.Background()),
Expand Down
6 changes: 3 additions & 3 deletions core/application/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M
// TODO: validate the spec

// Set the timestamp when the VMspec was created.
mvm.Spec.CreatedAt = a.ports.Clock().UnixMilli()
mvm.Spec.CreatedAt = a.ports.Clock().Unix()

createdMVM, err := a.ports.Repo.Save(ctx, mvm)
if err != nil {
Expand Down Expand Up @@ -90,7 +90,7 @@ func (a *app) UpdateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M
// TODO: check if update is valid (i.e. compare existing to requested update)

// Set the timestamp when the VMspec was updated.
mvm.Spec.UpdatedAt = a.ports.Clock().UnixMilli()
mvm.Spec.UpdatedAt = a.ports.Clock().Unix()

updatedMVM, err := a.ports.Repo.Save(ctx, mvm)
if err != nil {
Expand Down Expand Up @@ -127,7 +127,7 @@ func (a *app) DeleteMicroVM(ctx context.Context, id, namespace string) error {
}

// Set the timestamp when the VMspec was deleted.
foundMvm.Spec.DeletedAt = a.ports.Clock().UnixMilli()
foundMvm.Spec.DeletedAt = a.ports.Clock().Unix()

_, err = a.ports.Repo.Save(ctx, foundMvm)
if err != nil {
Expand Down

0 comments on commit 4f4329d

Please sign in to comment.