The foreshadowed clock
כי ענן על-המשכן יומם ואש תהיה לילה בו לעיני כל-בית-ישראל בכל-מסעיהם
A cloud [will be] upon the Miskan by day, and a [pillar of] fire will be on it by night, for the eyes of all the houses of Israel, for all of their journeys
The last verse of the book of Exodus concludes all the hard work that went into the Mishkan. The purpose of such a structure was to have G-d’s Presence on Earth. It was to be a place where Hashem was palpable, as much as could be possible in this physical world. A representation of Hashem appeared upon the Mishkan in the form of a cloud. It appeared after the erection of the Mishkan, to show the Jewish people that their construction efforts had paid off. The verse also describes that at night the cloud was replaced by a pillar of fire. However, the verse describes it in the future tense: a pillar of fire will be on it by night. Why isn’t it written in the present tense, as that was the reality for the Jews at that time? Further, why does the verse say that this fire was for the Jews’ journeys? It should have said: “for all their encampments”.
What was the purpose of the cloud by day, and fire by night? One opinion is for certain cases of spiritual impurity. Sometimes a person’s impurity is so severe that it takes a set number of days until they are ready to go to the mikveh. For example, a person who contracts tzaraas, a leprous-like skin ailment, requires waiting seven days towards the end of their purification process. Afterwards, they go to the mikveh. As well, a zav or zavah, who contracted a spiritually impure bodily discharge, also must wait seven days towards the end of their purification process. Hashem provided these twice-daily signs of the cloud and fire for the Jewish people for those who needed to could count their seven days of purification .
Rashi at the beginning of parshas Ki Sisa is bothered that two censuses of the Jewish people, taken in two different years, were exactly the same. How could this be? From his answer, it is clear that he held that that no one died during their entire first year post-Exodus. This is because when the Torah was given at Mount Sinai, the Jews were released from the curse of death, and were healed of all their blemishes. They remained in this lofty state until they later complained inexcusably after leaving Mount Sinai .
What this means then is during their entire time encamped at Mount Sinai, there was no need for the distinguishing signs to inform the people if it was night or day. There was no one afflicted with blemishes, so there was no pillar of fire in the evening. It was only when they began their first journey and started complaining that it became necessary, as they lost their lofty status. Some people became afflicted with blemishes and became spiritually impure. They needed to count seven days to finish their purification process. Hashem therefore made them a sign and alternated between a cloud on the Mishkan by day and a pillar of fire by night. The last verse of Shemos is thus speaking about the future, as it wasn’t relevant for the Jews at that time. They still had some time until they left Mount Sinai.
 Based on Chasam Sofer Al HaTorah to Exodus 40:38, from the year 5590
 Targum “Yonasan” ad. loc. See also HaEmek Davar ad. loc. The verse only says “fire”, but elsewhere (for example, Exodus 13:22) this fire was referred to as a pillar of fire
 Exodus 40:38
 See Rashi ad. loc.
 Midrash Tehillim 105:9, brought in Yalkut Shimoni § 417
 See Keilim 1:1 and Zavim 5:10
 See Leviticus 15:13, 28
 See Zis Ra’anan to Yalkut Shimoni loc. cit. § 7 and Panim Yafos to Exodus 40:38, who say that the cloud and fire were exclusively for these two mitzvos, and weren’t necessary to know when shabbos was, or other time-related mitzvos
 It’s not clear to me why they couldn’t just use the sun and the moon to count the days
 Exodus 30:16
 Cf. Ramban to verse 12 who doesn’t see why Rashi assumes no one died between the censuses. See note 14
 Midrash Tanchuma Shelach § 13, as well as the sources in note 14
 Numbers Chapter 11
 The Chasam Sofer writes in a few places (Teshuvos Chasam Sofer Orach Chaim § 149 s.v. שלא; Ibid Even HaEzer II § 59 s.v. ויל”ד; Chiddushei Chasam Sofer Nedarim 7b s.v. והנעל”ד) that there is a dispute when the Jews started to die again and be afflicted with blemishes. One opinion is from the sin of the Golden Calf, and the other is from the episode of the מתאוננים, when they started to complain. This dispute appears in Bamidbar Rabbah 7:4 and Vayikra Rabbah 18:2,4 (the latter two both brought in Yalkut Shimoni § 567). The Chasam Sofer suggests this is the dispute in Sukkah 25a about who were those were impure due to contact with the deceased, as well as the dispute between the Ramban and Rashi loc. cit. if people died in the first year after the Exodus. The Ramban loc. cit. holds like the opinion that says from the time of the Golden Calf, and Rashi like the other opinion. The Chasam Sofer goes with this latter approach
 I suppose the Chasam Sofer would assume this verse is then a difficulty against the opposing opinion in the Midrash
 Not until Numbers 10:11