-+ if (copy_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
-+ atime = (time_t)read_int(f);
-
- if (preserve_uid && !(flags & XMIT_SAME_UID))
- uid = (uid_t)read_int(f);
-@@ -629,6 +644,7 @@ static struct file_struct *receive_file_
-
- file->flags = 0;
- file->modtime = modtime;
-+ file->atime = atime;
- file->length = file_length;
- file->mode = mode;
- file->uid = uid;
-@@ -878,6 +894,7 @@ skip_filters:
-
- file->flags = flags;
- file->modtime = st.st_mtime;
-+ file->atime = st.st_atime;
- file->length = st.st_size;
- file->mode = st.st_mode;
- file->uid = st.st_uid;
---- orig/generator.c 2005-03-29 01:05:12
-+++ generator.c 2004-11-03 23:02:12
-@@ -372,7 +372,7 @@ static int unchanged_file(char *fn, stru
- if (ignore_times)
- return 0;
-
-- return cmp_modtime(st->st_mtime, file->modtime) == 0;
-+ return cmp_time(st->st_mtime, file->modtime) == 0;
- }
++ if (atimes_ndx && !S_ISDIR(mode) && !(xflags & XMIT_SAME_ATIME)) {
++ atime = read_varlong(f, 4);
++#if SIZEOF_TIME_T < SIZEOF_INT64
++ if (!am_generator && (int64)(time_t)atime != atime) {
++ rprintf(FERROR_XFER,
++ "Access time value of %s truncated on receiver.\n",
++ lastname);
++ }
++#endif
++ }
+
+ if (chmod_modes && !S_ISLNK(mode))
+ mode = tweak_mode(mode, chmod_modes);
+@@ -895,6 +915,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+ F_GROUP(file) = gid;
+ file->flags |= gid_flags;
+ }
++ if (atimes_ndx)
++ f_atime_set(file, (time_t)atime);
+ if (unsort_ndx)
+ F_NDX(file) = flist->used + flist->ndx_start;
+
+@@ -1241,6 +1263,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+ F_OWNER(file) = st.st_uid;
+ if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */
+ F_GROUP(file) = st.st_gid;
++ if (atimes_ndx)
++ f_atime_set(file, st.st_atime);
+
+ if (basename != thisname)
+ file->dirname = lastdir;
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
+@@ -21,6 +21,7 @@
+ */
+
+ #include "rsync.h"
++#include "ifuncs.h"
+
+ extern int verbose;
+ extern int dry_run;
+@@ -645,6 +646,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+ : iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !(iflags & ITEM_MATCHED)
+ && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
+ iflags |= ITEM_REPORT_TIME;
++ if (atimes_ndx && !S_ISDIR(file->mode) && !S_ISLNK(file->mode)
++ && cmp_time(f_atime(file), sxp->st.st_atime) != 0)
++ iflags |= ITEM_REPORT_ATIME;
+ #if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
+ if (S_ISLNK(file->mode)) {
+ ;
+@@ -1015,6 +1019,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+ if (link_dest) {
+ if (!hard_link_one(file, fname, cmpbuf, 1))
+ goto try_a_copy;
++ if (atimes_ndx)
++ set_file_attrs(fname, file, sxp, NULL, 0);
+ if (preserve_hard_links && F_IS_HLINKED(file))
+ finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j);
+ if (!maybe_ATTRS_REPORT && (verbose > 1 || stdout_format_has_i > 1)) {
+@@ -1200,6 +1206,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+ static void list_file_entry(struct file_struct *f)
+ {
+ char permbuf[PERMSTRING_SIZE];
++ time_t atime = atimes_ndx ? f_atime(f) : 0;
+ double len;