“Rav Huna said: If someone was walking on the way or in the desert, and he does not know when it is Shabbos, he counts six days from the day he realizes his unawareness (note #17: Including that day) and then observes one day as the Shabbos. Chiya bar Rav says: He first observes one day as Shabbos and then counts six days as weekdays. [The Gemara explains the dispute:] Regarding what issue do they disagree? One master (Rav Huna) holds that person should count like the creation of the world, i.e. just as the Shabbos followed the six days of creation, so too does he observe the Shabbos after counting six weekdays. The other master (Chiya bar Rav) holds the person should count like Adam, the first man, i.e. just as Adam was created on Friday and the very next day was Shabbos, so too this person observes the next day as Shabbos.”
The Gemara, after much discussion, refutes the opinion of Chiya bar Rav, and thus the halacha follows the opinion of Rav Huna. It is crucial to note that the statements of Rav Huna and Chiya bar Ravis should not to be understood at face value, i.e. neither opinion is advocating choosing a “random day” to observe Shabbos, while relegating the other days to the life of a weekday! After all, there is only one Shabbos; the fact that a person lost track of time does not change that fact! The more important principle at work here is that this person must act strictly and assume that ANY DAY COULD be Shabbos, and thus he should not do melacha at all – any day of the week!
So, what, then, does the Gemara mean – to designate one day as Shabbos? It means as follows: Inasmuch as a person is bidden to preserve his life, even if that necessitates violating Shabbos, he is permitted - indeed commanded! - to do a minimal amount of melacha – every day of the week, in order to sustain himself, but not more. On top of that, he should “choose” one day to be his Shabbos (i.e. the seventh day from when he realized his predicament, according to the final halacha), and on that day, he should make Kiddush and Havdala and try not to do any melacha at all, if possible! Note: The halacha does, in fact, permit him to walk every day – even on his designated Shabbos - to try to make it out of the desert. He may thus disregard the Rabbinic prohibition against walking outside of the city limits (Heb. Techumin), in order to save himself.
Note: If the person who is lost is able to determine which days he knows for sure are NOT Shabbos, then he may treat those days as weekdays in all ways. Shulchan Aruch goes into more detail about all of the possible permutations.
Ed: Final note for Mishnah Berura Volume III:
In the Biur Halacha – a second commentary written by the Chafetz Chaim to elaborate on various fine points not discussed in the Mishnah Berura – it is written that of the 39 melachos, there remain several that were not discussed in the Shulchan Aruch. They are all related to the intricate processes of weaving, and apparently were not so common as to warrant attention amid the myriad halachos of Shabbos that people need to know. The Biur Halacha goes on to give a short description of each of these halachos. I will excerpt that further and give a simple list and translation of each:
Menafetz - Disentangling, Combing
Toveh - Spinning
Maisach - Mounting the warp (stretching threads onto loom)
Oseh Shtei Batai Neirin - Setting two heddles (preparing to weave)
Oraig - Weaving
Potzai'ah - Separating (removing) threads (Unweaving