What is the difference between उसी समय and उस समय?
उसी and उस are both forms of the demonstrative pronoun वह (“that”, literally). They are oblique, singular forms of वह. The difference is that उसी is a special emphatic form of उस. उसी = उस + ही. I’ve written a few articles about emphatic particles, such as this article.
If you understand how ही is used, then you will understand how उसी is used.
One of the uses of the oblique case is to form adverbial expressions. The meaning depends on the context, but उस समय can mean “at that time”.
ही usually lends one of two emphases: उसी समय either means “at the same time”, “at that very time”, “right then”, “just then”, “contemporaneously”, “simultaneously” etc. It can also mean “immediately”, etc.
मैं लगभग उसी समय निकला जब वह पहुंच गया – “I left at about the same time that he arrived”
हम लोग उसी समय अन्दर गए जब हमें पता चला कि बारिश होने वाली थी – “When we realized that it was going to rain we went inside immediately”
There are several other expression that use emphatic forms of pronouns, such as:
इसी वक़्त – “right now” – “इसी वक़्त निचे आ जाओ” – “Come down right now”
वही – “the same”, “that very” – मैं वही सोच रहा था – “I was thinking the same thing”