"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Use modern POSIX timestamp fields in struct stat
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Thu, 10 Sep 2020 22:13:54 +0200

Download raw body.

Thread
On Thu, Sep 10, 2020 at 04:23:13PM +0200, Christian Weisgerber wrote:
> Use modern POSIX timestamp fields in struct stat
> 
> This is another instance where using the modern POSIX API eases
> portability without any drawback.  The timestamps in struct stat
> are now all struct timespec.
> 
> OK?

Yes, thanks!

> diff 3168e5da215c7b442d231f40bfd61df067505d8b /home/naddy/got
> blob - 1e59fdb908a5087e2dbdb5ce930a9743a9eead43
> file + lib/fileindex.c
> --- lib/fileindex.c
> +++ lib/fileindex.c
> @@ -105,10 +105,10 @@ got_fileindex_entry_update(struct got_fileindex_entry 
>  
>  	if ((ie->flags & GOT_FILEIDX_F_NO_FILE_ON_DISK) == 0) {
>  		if (update_timestamps) {
> -			ie->ctime_sec = sb.st_ctime;
> -			ie->ctime_nsec = sb.st_ctimensec;
> -			ie->mtime_sec = sb.st_mtime;
> -			ie->mtime_nsec = sb.st_mtimensec;
> +			ie->ctime_sec = sb.st_ctim.tv_sec;
> +			ie->ctime_nsec = sb.st_ctim.tv_nsec;
> +			ie->mtime_sec = sb.st_mtim.tv_sec;
> +			ie->mtime_nsec = sb.st_mtim.tv_nsec;
>  		}
>  		ie->uid = sb.st_uid;
>  		ie->gid = sb.st_gid;
> blob - 8afc4c2596b52c558eca6fd9e0ac8678040d308f
> file + lib/worktree.c
> --- lib/worktree.c
> +++ lib/worktree.c
> @@ -1569,10 +1569,10 @@ xbit_differs(struct got_fileindex_entry *ie, uint16_t 
>  static int
>  stat_info_differs(struct got_fileindex_entry *ie, struct stat *sb)
>  {
> -	return !(ie->ctime_sec == sb->st_ctime &&
> -	    ie->ctime_nsec == sb->st_ctimensec &&
> -	    ie->mtime_sec == sb->st_mtime &&
> -	    ie->mtime_nsec == sb->st_mtimensec &&
> +	return !(ie->ctime_sec == sb->st_ctim.tv_sec &&
> +	    ie->ctime_nsec == sb->st_ctim.tv_nsec &&
> +	    ie->mtime_sec == sb->st_mtim.tv_sec &&
> +	    ie->mtime_nsec == sb->st_mtim.tv_nsec &&
>  	    ie->size == (sb->st_size & 0xffffffff) &&
>  	    !xbit_differs(ie, sb->st_mode));
>  }
> -- 
> Christian "naddy" Weisgerber                          naddy@mips.inka.de
> 
>