github.com/anonymouse64/snapd@v0.0.0-20210824153203-04c4c42d842d/osutil/settime_32bit.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  // +build 386 arm
     4  // +build linux
     5  
     6  /*
     7   * Copyright (C) 2021 Canonical Ltd
     8   *
     9   * This program is free software: you can redistribute it and/or modify
    10   * it under the terms of the GNU General Public License version 3 as
    11   * published by the Free Software Foundation.
    12   *
    13   * This program is distributed in the hope that it will be useful,
    14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16   * GNU General Public License for more details.
    17   *
    18   * You should have received a copy of the GNU General Public License
    19   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20   *
    21   */
    22  
    23  package osutil
    24  
    25  import (
    26  	"syscall"
    27  	"time"
    28  )
    29  
    30  func init() {
    31  	timeToTimeval = timeToTimeval32
    32  }
    33  
    34  func timeToTimeval32(t time.Time) *syscall.Timeval {
    35  	return &syscall.Timeval{
    36  		Sec:  int32(t.Unix()),
    37  		Usec: int32(t.Nanosecond() / 1000),
    38  	}
    39  }