Relationship between two viewpoints on Thermodynamics I've always seem the standard viewpoint on Thermodynamics that it is all about studying phenomena related to a property of systems called temperature. Then we have the zeroth law which allows us to give means to measure temperature and so on. Every basic Physics course takes this viewpoint when discussing Thermodynamics, and I believe that historically this was the first viewpoint indeed.
Now, studying Thermodynamics in more in-depth books there's another viewpoint: that Thermodynamics is concerned with the study of equilibrium states of macroscopic matter. That is, we have some macroscopic piece of matter and we are interested in some states of equilibrium of that piece of matter.
It, however, doesn't seem obvious to me the connection between these two viewpoints. Of course one could say: "one of the properties of macroscopic matter on those equilibrium states is temperature", but again, it's not clear at first the connection between this and the first viewpoint. It's not really clear what temperature has to do with those equilibrium states.
So what's the relationship between those two viewpoints on Thermodynamics?
 A: If two systems $X$ and $Y$ are in contact such that they can exchange energy, then the statement

$X$ and $Y$ are in equilibrium.

is equivalent to the statement

$X$ and $Y$ are at the same temperature.

Here is a proof.
The total entropy of the combined system is
$$S = S_X + S_Y \qquad (1)$$
where $S_X$ is the entropy of system $X$, and similarly for $Y$.
Suppose we have a certain total energy $E$.
The amount of energy in system $X$ is denoted $E_X$.
The amount of energy in system $Y$ is $E_Y = E - E_X$.
In general, the entropy of each subsystem depends on the energy in that system.
Therefore, we can write $S_X = S_X(E_X)$ and $S_Y = S_Y(E_Y) = S_Y(E - E_Y)$.
The term "equilibrium" means that the combined system $X+Y$ is in a state such that nothing is changing as a function of time.
If you assume that entropy of a system always tends to increase, then saying that nothing is changing in times implies that the system is already in a maximum entropy state.
Therefore, we have shown that "equilibrium" means "maximum entropy".
If the combined system is at maximum entropy, then small changes in the distribution of energy between $X$ and $Y$ won't change the total entropy.
In math:
$$\frac{dS}{dE_X} = 0 . \qquad (2)$$
Rewriting Eq. (1),
$$
\begin{align}
S(E_X) &= S_X(E_X) + S_Y(E_Y) \\
&= S_X(E_X) + S_Y(E - E_X) \\
\frac{dS}{dE_X} &= \frac{dS_X}{dE_X} - \frac{dS_Y}{dE_X}
\end{align}
$$
and then using Eq. (2) gives
$$
\begin{align}
0 &= \frac{dS_X}{dE_X} - \frac{dS_Y}{dE_X} \\
\frac{dS_X}{dE_X} &= \frac{dS_Y}{dE_X} .
\end{align}
$$
Defining $T \equiv dE/dS$, we can rewrite this as
$$
T_X = T_Y
$$
which shows that the subsystems have the same temperature.
Therefore, we have shown that, in the case that two subsystems can share energy, the state of equilibrium is the same as having the same temperature.
A: Regarding the first viewpoint, it has also been long emphasized that thermodynamics is about studying phenomena related to a property of equilibrium systems called temperature. The equilibrium is always important in all thermodynamics --- although you can make up some measure of temperature for a nonequilibrium system, none of the familiar thermodynamic formulas will apply and so you don't really have thermodynamic behaviour anymore.
The second viewpoint is not really thermodynamics per se. Rather this is the point of view of statistical mechanics, i.e., the rational justification of thermodynamics from mechanical laws. Statistical mechanics tells us that standard thermodynamics is most plainly evident in the macroscopic limit. Of course statistical mechanics also goes beyond the macroscopic limit and in a way lets us "extend" thermodynamics.
