How secure is MD5 for one way authentication? I have a server S1 with an Private String (PS) as an identifier shared with a server S2.

Every 10 min S1 publish the hash value of PS+the current time which is used as  public identifier (PI). Every one can see the value of PI in the internet. As S2 has the value of PS, he also use MD5 to get the hash value of PS+the current time and compare it to the value published by S1 and therefore identify that the value provide from S1.

My solution is working but I am wondering how secure it is ? 
The private string PS shared between S1 and S1 looks like

PS=KJGFDFGHJK65456789876RFBNJK567Y7654RFGHJhhhHGE457UHKJHCDFG7654RF
hash=md5(hours time in millisecond+PS)
PI=fe**63**7b00-1cf0-11e6-b**d**f4-08002**00**c9a66


I use a mask to get some values from the hash and use them to construct the Public Identifier. The blood values are random values, not taken in consideration to identify the server. If someone collect the keys I am publishing for few days, will it be possible form him to identify the Private String S1 is using to generate public keys, or that the key provide probably from S1 and not another server ? I hope you understand what I mean, my knowledge in cryptography are very basic and it's hard for me to use technical vocabular.
Every 10 min S1 publish the hash value of PS+the current time which is used as public identifier (PI). Every one can see the value of PI in the internet. As S2 has the value of PS, he also use MD5 to get the hash value of PS+the current time and compare it to the value published by S1 and therefore identify that the value provide from S1.


Essentially, you would be using MD5(M + K) as a MAC. That is insecure.

The construction where you append the key to the message and then hash is not a secure MAC when the hash function lacks collision resistance, like MD5 does. (Technically, you need a collision attack on the compression function.)

Even though using a collision resistant hash (like SHA-256) would likely make what you are doing secure, I would recommend using a real MAC. For example, HMAC, for which you ought to find an implementation in almost any programming environment.