In its documentation of ChangeMessageVisibility function, Amazon gives the following example:
For example, you have a message with a visibility timeout of 5
minutes. After 3 minutes, you call ChangeMessageVisibility with a
timeout of 10 minutes. You can continue to call
ChangeMessageVisibility to extend the visibility timeout to the
maximum allowed time. If you try to extend the visibility timeout
beyond the maximum, your request is rejected.
so, after I change the visibility time of msg to 10 minutes,
it has 10 minutes, 12 minutes or 8 minutes left?
The message has 10 minutes left.
ChangeMessageVisibility sets the timer to a new value, from which it starts counting down.
The documentation confuses the issue with the mention of 5 and 3 minutes. The point appears to be that you need to make the call before the timer expires, otherwise it is too late, because the message has already become visible again and may have been delivered to another consumer.